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.
18 * @file FSecISecretKey.h
19 * @brief This is the header file for the %ISecretKey interface.
21 * This header file contains the declarations of the %ISecretKey interface.
23 #ifndef _FSEC_ISECRET_KEY_H_
24 #define _FSEC_ISECRET_KEY_H_
29 namespace Tizen { namespace Security
33 * @interface ISecretKey
34 * @brief This interface provides methods that help in setting the buffer for the key. These methods also extract the encoding format of the key.
38 * The %ISecretKey interface provides methods that help in setting the buffer for the key. These methods also extract the encoding format of the key. @n
40 * 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 class _OSP_EXPORT_ ISecretKey
49 * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes @n
50 * are called when the destructor of this interface is called.
54 virtual ~ISecretKey(void){}
57 * Gets the name of the primary encoding format of this key.
61 * @return The primary encoding format of the key
63 virtual Tizen::Base::String GetFormat(void) const = 0;
66 * Gets the secret key in its primary encoding format.
70 * @return A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
71 * else @c null if an error occurs
72 * @exception E_SUCCESS The method is successful.
73 * @exception E_OUT_OF_MEMORY The memory is insufficient.
74 * @remarks The specific error code can be accessed using the GetLastResult() method.
76 virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const = 0;
79 * Sets the secret key buffer.
83 * @return An error code
84 * @param[in] keyBuffer An instance of Tizen::Base::ByteBuffer
85 * @exception E_SUCCESS The method is successful.
86 * @exception E_INVALID_ARG The specified @c keyBuffer is invalid.
88 virtual result SetKey(const Tizen::Base::ByteBuffer& keyBuffer) = 0;
92 // This method is for internal use only. Using this method can cause behavioral, security-related,
93 // and consistency-related issues in the application.
95 // This method is reserved and may change its name at any time without prior notice.
99 virtual void ISecretKey_Reserved1(void) {}
103 } } //Tizen::Security
105 #endif //_FSEC_ISECRET_KEY_H_