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