Merge "Add to retry to read DUID." into tizen_2.2
[platform/framework/native/appfw.git] / inc / FSecISecretKey.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file                FSecISecretKey.h
19  * @brief               This is the header file for the %ISecretKey interface.
20  *
21  * This header file contains the declarations of the %ISecretKey interface.
22  */
23 #ifndef _FSEC_ISECRET_KEY_H_
24 #define _FSEC_ISECRET_KEY_H_
25
26 #include <FSecIKey.h>
27
28
29 namespace Tizen { namespace Security
30 {
31
32 /**
33  * @interface   ISecretKey
34  * @brief               This interface provides methods that help in setting the buffer for the key. These methods also extract 
35  *                              the encoding format of the key.
36  *
37  * @since               2.0
38  *
39  * The %ISecretKey interface provides methods that help in setting the buffer for the key. These methods also extract the 
40  * encoding format of the key. @n
41  *
42  * 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  *
44  */
45 class _OSP_EXPORT_ ISecretKey
46         : public virtual IKey
47 {
48
49 public:
50         /**
51          * This polymorphic destructor should be overridden if required. @n 
52          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
53          *
54          * @since               2.0
55          */
56         virtual ~ISecretKey(void){}
57
58         /**
59          * Gets the name of the primary encoding format of this key.
60          *
61          * @since               2.0
62          *
63          * @return              The primary encoding format of the key
64          */
65         virtual Tizen::Base::String GetFormat(void) const = 0;
66
67         /**
68          * Gets the secret key in its primary encoding format.
69          *
70          * @since               2.0
71          *
72          * @return              A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
73          *                              else @c null if an error occurs
74          * @exception   E_SUCCESS                               The method is successful.
75          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
76          * @remarks             The specific error code can be accessed using the GetLastResult() method.
77          */
78         virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const = 0;
79
80         /**
81          * Sets the secret key buffer.
82          *
83          * @since               2.0
84          *
85          * @return              An error code
86          * @param[in]   keyBuffer                               An instance of Tizen::Base::ByteBuffer
87          * @exception   E_SUCCESS                               The method is successful.
88          * @exception   E_INVALID_ARG                   The specified @c keyBuffer is invalid.
89          */
90         virtual result SetKey(const Tizen::Base::ByteBuffer& keyBuffer) = 0;
91
92 protected:
93         //
94         // This method is for internal use only. Using this method can cause behavioral, security-related,
95         // and consistency-related issues in the application.
96         //
97         // This method is reserved and may change its name at any time without prior notice.
98         //
99         // @since 2.0
100         //
101         virtual void ISecretKey_Reserved1(void) {}
102
103 }; //ISecretKey
104
105 } } //Tizen::Security
106
107 #endif //_FSEC_ISECRET_KEY_H_