sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FSecIKey.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                        FSecIKey.h
20  * @brief               This is the header file for the %IKey interface.
21  *
22  * This header file contains the declarations of the %IKey interface.
23  */
24 #ifndef _FSEC_IKEY_H_
25 #define _FSEC_IKEY_H_
26
27 #include <FBase.h>
28
29 namespace Tizen { namespace Security
30 {
31
32 /**
33  * @interface   IKey
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.
35  *
36  * @since               2.0
37  *
38  * The %IKey interface provides methods that help in setting the buffer for the key. These methods also extract the encoding format of the key. @n
39  *
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>.
41  *
42  * @see Tizen::Security::IPrivateKey
43  * @see Tizen::Security::IPublicKey
44  * @see Tizen::Security::ISecretKey
45  * @see Tizen::Security::PrivateKey
46  * @see Tizen::Security::PublicKey
47  * @see Tizen::Security::SecretKey
48  */
49 class _OSP_EXPORT_ IKey
50 {
51
52 public:
53         /**
54          * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes @n
55          * are called when the destructor of this interface is called.
56          *
57          * @since       2.0
58          */
59         virtual ~IKey(void){}
60
61         /**
62          * Gets the name of the primary encoding format of the key.
63          *
64          * @since               2.0
65          *
66          * @return              The primary encoding format of the key
67          */
68         virtual Tizen::Base::String GetFormat(void) const = 0;
69
70         /**
71          * Gets the key in its primary encoding format.
72          *
73          * @since               2.0
74          *
75          * @return              A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
76          *                              else @c null if an error occurs
77          * @exception   E_SUCCESS                       The method is successful.
78          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
79          * @remarks     The specific error code can be accessed using the GetLastResult() method.
80          */
81         virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const = 0;
82
83         /**
84          * Sets the key buffer.
85          *
86          * @since               2.0
87          *
88          * @return              An error code
89          * @param[in]   keyBuffer                       An instance of Tizen::Base::ByteBuffer
90          * @exception   E_SUCCESS                       The method is successful.
91          * @exception   E_INVALID_ARG           The specified @c keyBuffer is invalid.
92          */
93         virtual result SetKey(const Tizen::Base::ByteBuffer& keyBuffer) = 0;
94
95 protected:
96         //
97         // This method is for internal use only. Using this method can cause behavioral, security-related,
98         // and consistency-related issues in the application.
99         //
100         // This method is reserved and may change its name at any time without prior notice.
101         //
102         // @since 2.0
103         //
104         virtual void IKey_Reserved1(void) {}
105
106 }; //IKey
107
108 } } //Tizen::Security
109
110 #endif // _FSEC_IKEY_H_