[ACR][10/10/2013][Remove]Removing API versioning to support E_OUT_OF_RANGE exception...
[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 the encoding format of the key.
35  *
36  * @since               2.0
37  *
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
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  */
43 class _OSP_EXPORT_ ISecretKey
44         : public virtual IKey
45 {
46
47 public:
48         /**
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.
51          *
52          * @since               2.0
53          */
54         virtual ~ISecretKey(void){}
55
56         /**
57          * Gets the name of the primary encoding format of this key.
58          *
59          * @since               2.0
60          *
61          * @return              The primary encoding format of the key
62          */
63         virtual Tizen::Base::String GetFormat(void) const = 0;
64
65         /**
66          * Gets the secret key in its primary encoding format.
67          *
68          * @since               2.0
69          *
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.
75          */
76         virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const = 0;
77
78         /**
79          * Sets the secret key buffer.
80          *
81          * @since               2.0
82          *
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.
87          */
88         virtual result SetKey(const Tizen::Base::ByteBuffer& keyBuffer) = 0;
89
90 protected:
91         //
92         // This method is for internal use only. Using this method can cause behavioral, security-related,
93         // and consistency-related issues in the application.
94         //
95         // This method is reserved and may change its name at any time without prior notice.
96         //
97         // @since 2.0
98         //
99         virtual void ISecretKey_Reserved1(void) {}
100
101 }; //ISecretKey
102
103 } } //Tizen::Security
104
105 #endif //_FSEC_ISECRET_KEY_H_