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