sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FSecSecretKey.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                        FSecSecretKey.h
20  * @brief               This is the header file for the %SecretKey class.
21  *
22  * This header file contains the declarations of the %SecretKey class.
23  */
24 #ifndef _FSEC_SECRET_KEY_H_
25 #define _FSEC_SECRET_KEY_H_
26
27 #include <FSecIKey.h>
28 #include <FSecISecretKey.h>
29
30
31 namespace Tizen { namespace Security
32 {
33
34 /**
35  *      @class          SecretKey
36  *      @brief          This class specifies a secret key.
37  *
38  * @since           2.0
39  *
40  *  The %SecretKey class manages a secret key, which is used in symmetric ciphers, such as Advanced Encryption Standard (AES), Data Encryption Standard (DES), and Triple Data Encryption Standard (3DES). @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  *      @see        IKey
45  *      @see        ISecretKey
46  *      @see        SecretKeyGenerator
47  *      @see        ISecretKeyGenerator
48  */
49 class _OSP_EXPORT_ SecretKey
50         : public virtual IKey
51         , public virtual ISecretKey
52         , public Tizen::Base::Object
53 {
54
55 public:
56         /**
57          *      This is the default constructor for this class.
58          *
59          *      @since      2.0
60          */
61         SecretKey(void);
62
63         /**
64          * This destructor overrides Tizen::Base::Object::~Object().
65          *
66          *      @since      2.0
67          */
68         virtual ~SecretKey(void);
69
70         /**
71          *      Gets the name of the primary encoding format of the current instance of %SecretKey.
72          *
73          * @since       2.0
74          *
75          *      @return         The primary encoding format of a key
76          */
77         virtual Tizen::Base::String GetFormat(void) const;
78
79         /**
80          *      Gets the secret key in its primary encoding format.
81          *
82          *      @since           2.0
83          *
84          *      @return         A pointer to the Tizen::Base::ByteBuffer class, @n
85          *                                      else @c null if an error occurs
86          *      @exception      E_SUCCESS                               The method is successful.
87          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
88          *      @remarks        The specific error code can be accessed using the GetLastResult() method.
89          */
90         virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const;
91
92         /**
93          *      Sets the secret key buffer.
94          *
95          *      @since           2.0
96          *
97          *      @return         An error code
98          *      @param[in]      keyBuffer                               An instance of Tizen::Base::ByteBuffer
99          *      @exception      E_SUCCESS                               The method is successful.
100          *      @exception      E_INVALID_ARG           The specified @c keyBuffer is invalid.
101          */
102         virtual result SetKey(const Tizen::Base::ByteBuffer& keyBuffer);
103
104 private:
105
106         //
107         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
108         //
109         // @since 2.0
110         //
111         SecretKey(const SecretKey& rhs);
112
113         //
114         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
115         //
116         // @since 2.0
117         //
118         SecretKey& operator =(const SecretKey& rhs);
119
120 private:
121         Tizen::Base::ByteBuffer __keyBytes;
122
123         class _SecretKeyImpl* __pSecretKeyImpl;
124         friend class _SecretKeyImpl;
125
126 };  //SecretKey
127
128 } } // Tizen::Security
129
130 #endif //_FSEC_SECRET_KEY_H_