Merge "Apply reviewed doxygen header" into tizen_2.2
[platform/framework/native/appfw.git] / inc / FSecIKeyPairGenerator.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                FSecIKeyPairGenerator.h
19  * @brief               This is the header file for the %IKeyPairGenerator interface.
20  *
21  * This header file contains the declarations of the %IKeyPairGenerator interface.
22  */
23 #ifndef _FSEC_IKEY_PAIR_GENERATOR_H_
24 #define _FSEC_IKEY_PAIR_GENERATOR_H_
25
26 #include <FBaseString.h>
27 #include <FSecKeyPair.h>
28
29
30 namespace Tizen { namespace Security
31 {
32
33 /**
34  * @interface   IKeyPairGenerator
35  * @brief               This interface provides the abstract methods for generating a pair of public and private keys.
36  *
37  * @since               2.0
38  *
39  * The %IKeyPairGenerator interface provides the abstract methods for generating a pair of public and private keys. @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                 Tizen::Security::KeyPair
44  */
45 class _OSP_EXPORT_ IKeyPairGenerator
46 {
47
48 public:
49         /**
50          * This polymorphic destructor should be overridden if required. @n 
51          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
52          *
53          *      @since          2.0
54          */
55         virtual ~IKeyPairGenerator(void){}
56
57         /**
58          * Constructs and initializes an instance of %IKeyPairGenerator with the specified modulus size.
59          *
60          * @since               2.0
61          *
62          * @return              An error code
63          * @param[in]   modulusBitSize          The modulus size in bits
64          * @exception   E_SUCCESS                       The method is successful.
65          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
66          *                                                                      - The specified @c modulusBitSize is invalid.
67          *                                                                      - The modulus size must be atleast greater than or equal to @c 1024 bits 
68          *                                                                      to generate cryptographically secure keys.
69          */
70         virtual result Construct(int modulusBitSize) = 0;
71
72         /**
73          * Generates a new key pair.
74          *
75          * @since               2.0
76          *
77          * @return              A pointer to the KeyPair class, @n
78          *                              else @c null if the method fails to generate the key pair
79          * @exception   E_SUCCESS                                       The method is successful.
80          * @exception   E_UNSUPPORTED_ALGORITHM         The requested algorithm is not supported.
81          * @exception   E_OUT_OF_MEMORY                         The memory is insufficient.
82          * @exception   E_SYSTEM                                        Either of the following conditions has occurred:
83          *                                                                                      - A system error has occurred.
84          *                                                                                      - The method has failed to operate with the OpenSSL library.
85          * @remarks             The specific error code can be accessed using the GetLastResult() method.
86          */
87         virtual Tizen::Security::KeyPair* GenerateKeyPairN(void) const = 0;
88
89 protected:
90         //
91         // This method is for internal use only. Using this method can cause behavioral, security-related,
92         // and consistency-related issues in the application.
93         //
94         // This method is reserved and may change its name at any time without prior notice.
95         //
96         // @since 2.0
97         //
98         virtual void IKeyPairGenerator_Reserved1(void) {}
99
100 }; //IKeyPairGenerator
101
102 } } //Tizen::Security
103
104 #endif // _FSEC_IKEY_PAIR_GENERATOR_H_