Merge "Added new method to the NotificationManager Interface" into tizen_2.2
[platform/framework/native/appfw.git] / inc / FSecPublicKey.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                FSecPublicKey.h
19  * @brief               This is the header file for the %PublicKey class.
20  *
21  * This header file contains the declarations of the %PublicKey class.
22  */
23 #ifndef _FSEC_PUBLIC_KEY_H_
24 #define _FSEC_PUBLIC_KEY_H_
25
26 #include <FSecIKey.h>
27 #include <FSecIPublicKey.h>
28
29
30 namespace Tizen { namespace Security
31 {
32
33 /**
34  *      @class          PublicKey
35  *      @brief          This class provides methods for managing the RSA public key.
36  *
37  *      @since          2.0
38  *
39  * The %PublicKey class manages a public key, which is used in asymmetric ciphers.
40  * The RSA algorithm encrypts the data using the public 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  *      @see    IKey
45  *      @see    IPublicKey
46  *      @see    IKeyPairGenerator
47  */
48 class _OSP_EXPORT_ PublicKey
49         : public virtual IKey
50         , public virtual IPublicKey
51         , public Tizen::Base::Object
52 {
53 public:
54         /**
55          *      This is the default constructor for this class.
56          *
57          * @since               2.0
58          */
59         PublicKey(void);
60
61         /**
62          * This destructor overrides Tizen::Base::Object::~Object().
63          *
64          * @since               2.0
65          */
66         virtual ~PublicKey(void);
67
68         /**
69          *      Gets the name of the primary encoding format of the current instance of %PublicKey.
70          *
71          *      @since          2.0
72          *
73          *      @return         The primary encoding format of the key
74          */
75         virtual Tizen::Base::String GetFormat(void) const;
76
77         /**
78          *      Gets the public key in its primary encoding format.
79          *
80          *      @since          2.0
81          *
82          *      @return         A pointer to the Tizen::Base::ByteBuffer class, @n
83          *                              else @c null if an error occurs
84          *      @exception      E_SUCCESS                               The method is successful.
85          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
86          *      @remarks        The specific error code can be accessed using the GetLastResult() method.
87          */
88         virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const;
89
90         /**
91          *      Sets the public key buffer.
92          *
93          *      @since          2.0
94          *
95          *      @return         An error code
96          *      @param[in]      keyBuffer                               An instance of Tizen::Base::ByteBuffer
97          *      @exception      E_SUCCESS                               The method is successful.
98          *      @exception      E_INVALID_ARG                   The specified @c keyBuffer is invalid.
99          *      @remarks        Only ASN.1 encoding format is supported for input buffer.
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         PublicKey(const PublicKey& 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         PublicKey& operator =(const PublicKey& rhs);
118
119 private:
120         Tizen::Base::String __algorithm;
121         Tizen::Base::String __encodedFormat;
122         Tizen::Base::ByteBuffer __keyBytes;
123
124         class _PublicKeyImpl* __pPublicKeyImpl;
125         friend class _PublicKeyImpl;
126
127 }; //PublicKey
128
129 } } //Tizen::Security
130
131 #endif //_FSEC_PUBLIC_KEY_H_