update doxygen comments
[platform/framework/native/appfw.git] / inc / FSecPkcsPkcs05PbEs2Parameters.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2013 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                FSecPkcsPkcs05PbEs2Parameters.h
20  * @brief               This is the header file for the %Pkcs05PbEs2Parameters class.
21  *
22  * This header file contains the declarations of the %Pkcs05PbEs2Parameters class.
23  */
24
25 #ifndef _FSEC_PKCS_PKCS_05_PBES2_PARAMETERS_H_
26 #define _FSEC_PKCS_PKCS_05_PBES2_PARAMETERS_H_
27
28
29 #include <FBaseByteBuffer.h>
30 #include <FSecPkcsIAlgorithmParameters.h>
31 #include <FSecPkcsAlgorithmIdentifier.h>
32 #include <FSecPkcsTypes.h>
33
34 namespace Tizen { namespace Security { namespace Pkcs
35 {
36
37 /**
38  * @class               Pkcs05PbEs2Parameters
39  * @brief               This class implements the functionalities specified by the PKCS05 encryption scheme 2.
40  *
41  * @since               2.1
42  *
43  * The %Pkcs05PbEs2Parameters class implements the functionalities specified by the PKCS05 encryption scheme 2.
44  *                                      PBES2 combines a password-based key derivation function, which is PBKDF2
45  *                                      for PKCS #5 version 2.1, with an underlying encryption scheme.
46  *                                      The key length and any other parameters for the underlying encryption scheme depends on the scheme.
47  *
48  *              This is defined in ASN.1 as demonstrated in the following code:
49  * @code
50  *              PBES2-params ::= SEQUENCE {
51  *              keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},
52  *              encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} }
53  * @endcode
54  *
55  */
56
57 class _OSP_EXPORT_ Pkcs05PbEs2Parameters
58         : public virtual IAlgorithmParameters
59         , public Tizen::Base::Object
60 {
61
62
63 public:
64         /**
65          * The object is not fully constructed after this constructor is called. @n
66          * For full construction, the Construct() method must be called right after calling this constructor.
67          *
68          * @since               2.1
69          */
70         Pkcs05PbEs2Parameters(void);
71
72         /**
73          * This destructor overrides Tizen::Base::Object::~Object().
74          *
75          * @since               2.1
76          */
77         virtual ~Pkcs05PbEs2Parameters(void);
78
79         /**
80          * Initializes this instance of %Pkcs05PbEs2Parameters with the encoded Tizen::Base::ByteBuffer, which contain Password Based Encryption Parameters Structure(PBES2) in ASN.1 DER format.
81          *
82          * @since               2.1
83          *
84          * @return              An error code
85          * @param[in]   encodedData                             The DER encoded Tizen::Base::ByteBuffer containing %Pkcs05PbEs2Parameters
86          * @exception   E_SUCCESS                                       The method is successful.
87          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
88          */
89         result Construct(const Tizen::Base::ByteBuffer& encodedData);
90
91         /**
92          * Initializes this %Pkcs05PbEs2Parameters with specified input parameters values.
93          *
94          * @since               2.1
95          *
96          * @return              An error code
97          * @param[in]   keyDerivationFunction           An instance of AlgorithmIdentifier, holding key derivation function
98          * @param[in]   encryptionScheme                An instance of AlgorithmIdentifier, holding encryption scheme
99          * @exception   E_SUCCESS                                               The method is successful.
100          * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
101          */
102         result Construct(const AlgorithmIdentifier& keyDerivationFunction, const AlgorithmIdentifier& encryptionScheme);
103
104         /**
105          * Gets the encoded form of the %Pkcs05PbEs2Parameters. @n
106          * It is assumed that each %Pkcs05PbEs2Parameters will have only a single form of encoding example ASN.1 DER.
107          *
108          * @since               2.1
109          *
110          * @return              A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
111          *                                              else @c null if an error occurs
112          * @exception   E_SUCCESS                                       The method is successful.
113          * @exception   E_SYSTEM                                        The method cannot proceed due to a severe system error.
114          * @remarks             The specific error code can be accessed using the GetLastResult() method.
115          */
116         Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
117
118         /**
119          * Gets the reference to the AlgorithmIdentifier instance, which identifies the underlying key derivation function. @n
120          * It will be an algorithm ID with an OID in the set PBES2-KDFs, which for this version of PKCS #5 will consist of id-PBKDF2.
121          *
122          * @since               2.1
123          *
124          * @return              A reference to AlgorithmIdentifier holding the underlying key derivation function
125          * @remarks             The specific error code can be accessed using the GetLastResult() method.
126          */
127         const AlgorithmIdentifier& GetKeyDerivationAlgorithm(void) const;
128
129         /**
130          * Gets the reference to the AlgorithmIdentifier instance, which identifies the underlying encryption algorithm. @n
131          * It shall be an OID in the set PBES2-Encs, whose definition is left to the application.
132          *
133          * @since               2.1
134          *
135          * @return              A reference to AlgorithmIdentifier holding the underlying encryption algorithm
136          * @remarks             The specific error code can be accessed using the GetLastResult() method.
137          */
138         const AlgorithmIdentifier& GetEncryptionScheme(void) const;
139
140         /**
141          * Gets the AlgorithmParameters that identifies the underlying parameters such as PbKdf2, PbEs2, PbMac1. @n
142          * For this class %AlgorithmParameters will be of PBES2 type.
143          *
144          * @since               2.1
145          *
146          * @return              A pointer to IAlgorithmParameters containing the algorithm identifier of underlying pseudo random function, @n
147          *                              else @c null if an error occurs
148          * @remarks             The specific error code can be accessed using the GetLastResult() method.
149          */
150         virtual IAlgorithmParameters* CloneN(void) const;
151
152         /**
153          *
154          * Gets the PkcsAlgorithmParameterType value.
155          *
156          * @since               2.1
157          *
158          * @return              PkcsAlgorithmParameterType holding enum value @c PKCS_ALGO_PARAM_TYPE_PKCS05_PBES02 for PBES2 Parameters
159          *
160          */
161         virtual PkcsAlgorithmParameterType GetType(void) const;
162
163         /**
164          * Checks whether the specified instance of %Pkcs05PbEs2Parameters equals the current instance.
165          *
166          * @since               2.1
167          *
168          * @return              @c true if the specified instance equals the current instance, @n
169          *              else @c false
170          * @param[in]   rhs                                                     An instance of %Pkcs05PbEs2Parameters
171          * @exception   E_SUCCESS                               The method is successful.
172          * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
173          * @remarks             The specific error code can be accessed using the GetLastResult() method.
174          */
175         virtual bool Equals(const Tizen::Base::Object& rhs) const;
176
177         /**
178          * Gets the hash value of the current instance of %Pkcs05PbEs2Parameters.
179          *
180          * @since               2.1
181          *
182          * @return              An integer value indicating the hash value of the current instance of %Pkcs05PbEs2Parameters
183          */
184         virtual int GetHashCode(void) const;
185
186 private:
187         // This copy constructor is intentionally declared as private to prohibit @n
188         // copying of objects by users.
189         //
190         // @since               2.1
191         Pkcs05PbEs2Parameters(const Pkcs05PbEs2Parameters& rhs);
192
193         // The implementation of this copy assignment operator is intentionally blank and @n
194         // declared as private to prohibit copying of objects.Use CloneN() to get an exact copy of the instance. @n
195         // Use Equals() to compare the contents of one instance with the other.
196         //
197         // @since               2.1
198         Pkcs05PbEs2Parameters& operator =(const Pkcs05PbEs2Parameters& rhs);
199
200 private:
201         class _Pkcs05PbEs2ParametersImpl* __pPkcs05PbEs2ParametersImpl;
202         friend class _Pkcs05PbEs2ParametersImpl;
203 };  //Pkcs05PbEs2Parameters
204
205 } } } // Tizen::Security::Pkcs
206
207 #endif // _FSEC_PKCS_PKCS_05_PBES2_PARAMETERS_H_