sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FSecIKeyParameters.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                        FSecIKeyParameters.h
20  * @brief               This is the header file for the %IKeyParameters interface.
21  *
22  * This header file contains the declarations of the %IKeyParameters interface.
23  */
24 #ifndef _FSEC_CRYPTO_IKEY_PARAMETERS_H_
25 #define _FSEC_CRYPTO_IKEY_PARAMETERS_H_
26
27 #include <FBaseByteBuffer.h>
28 #include <FSecCryptoTypes.h>
29
30 namespace Tizen { namespace Security
31 {
32
33 /**
34  * @interface   IKeyParameters
35  * @brief               This interface provides the abstract methods for retrieving the parameters of the key exchange algorithms.
36  *
37  * @since               2.0
38  *
39  * The %IKeyParameters interface provides the abstract methods for retrieving the parameters of the key exchange algorithms. @n
40  *
41  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/key_exchange_algorithm.htm">Key exchanging</a>.
42  *
43  * @see                 Tizen::Security::KeyPair
44  */
45 class _OSP_EXPORT_ IKeyParameters
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 ~IKeyParameters(void) {}
56
57         /**
58          * Gets the value of the parameter for a specified key parameter type.
59          *
60          * @since               2.0
61          *
62          * @return              A pointer to the Tizen::Base::ByteBuffer class that contains the parameter values, @n
63          *                              else @c null if an error occurs
64          * @param[in]   paramType                               The type of the parameter @n
65          *                                                                                      For example, @c KEY_PARAMETER_DH_G.
66          * @exception   E_SUCCESS                               The method is successful.
67          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
68          * @exception   E_UNSUPPORTED_TYPE              The specified @c paramType is not supported.
69          * @remarks             The specific error code can be accessed using the GetLastResult() method.
70          */
71         virtual Tizen::Base::ByteBuffer* GetParameterValueN(KeyParameterType paramType) const = 0;
72
73         /**
74          * Gets the size of the key parameter in bits for the specified key parameter type.
75          *
76          * @since               2.0
77          *
78          * @return              The size of the parameter, @n
79          *                              else @c 0 if an error occurs
80          * @param[in]   keyParameterType                The type of the parameter @n
81          *                                                                              For example, @c PRIVATE_KEY_SIZE.
82          * @exception   E_SUCCESS                               The method is successful.
83          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
84          * @exception   E_UNSUPPORTED_TYPE              The specified @c paramType is not supported.
85          * @remarks             The specific error code can be accessed using the GetLastResult() method.
86          */
87         virtual int GetParameterSize(KeyParameterType keyParameterType) 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 IKeyParameters_Reserved1(void) {}
99
100         //
101         // This method is for internal use only. Using this method can cause behavioral, security-related,
102         // and consistency-related issues in the application.
103         //
104         // This method is reserved and may change its name at any time without prior notice.
105         //
106         // @since 2.0
107         //
108         virtual void IKeyParameters_Reserved2(void) {}
109
110 }; //IKeyParameters
111
112 } } //Tizen::Security
113
114 #endif //_FSEC_CRYPTO_IKEY_PAIR_PARAMETERS_H_