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