2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
19 * @brief This is the header file for the %IKey interface.
21 * This header file contains the declarations of the %IKey interface.
28 namespace Tizen { namespace Security
33 * @brief This interface provides methods that help in setting the buffer for the key. These methods also extract
34 * the encoding format of the key.
38 * The %IKey interface provides methods that help in setting the buffer for the key. These methods also extract the encoding
39 * format of the key. @n
41 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/key_mgmt_and_csprng.htm">Key Management and CSPRNG</a>.
43 * @see Tizen::Security::IPrivateKey
44 * @see Tizen::Security::IPublicKey
45 * @see Tizen::Security::ISecretKey
46 * @see Tizen::Security::PrivateKey
47 * @see Tizen::Security::PublicKey
48 * @see Tizen::Security::SecretKey
50 class _OSP_EXPORT_ IKey
55 * This polymorphic destructor should be overridden if required. @n
56 * This way, the destructors of the derived classes are called when the destructor of this interface is called.
63 * Gets the name of the primary encoding format of the key.
67 * @return The primary encoding format of the key
69 virtual Tizen::Base::String GetFormat(void) const = 0;
72 * Gets the key in its primary encoding format.
76 * @return A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
77 * else @c null if an error occurs
78 * @exception E_SUCCESS The method is successful.
79 * @exception E_OUT_OF_MEMORY The memory is insufficient.
80 * @remarks The specific error code can be accessed using the GetLastResult() method.
82 virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const = 0;
85 * Sets the key buffer.
89 * @return An error code
90 * @param[in] keyBuffer An instance of Tizen::Base::ByteBuffer
91 * @exception E_SUCCESS The method is successful.
92 * @exception E_INVALID_ARG The specified @c keyBuffer is invalid.
94 virtual result SetKey(const Tizen::Base::ByteBuffer& keyBuffer) = 0;
98 // This method is for internal use only. Using this method can cause behavioral, security-related,
99 // and consistency-related issues in the application.
101 // This method is reserved and may change its name at any time without prior notice.
105 virtual void IKey_Reserved1(void) {}
109 } } //Tizen::Security
111 #endif // _FSEC_IKEY_H_