2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FSecPkcsPkcs05PbEs2Parameters.h
20 * @brief This is the header file for the %Pkcs05PbEs2Parameters class.
22 * This header file contains the declarations of the %Pkcs05PbEs2Parameters class.
25 #ifndef _FSEC_PKCS_PKCS_05_PBES2_PARAMETERS_H_
26 #define _FSEC_PKCS_PKCS_05_PBES2_PARAMETERS_H_
29 #include <FBaseByteBuffer.h>
30 #include <FSecPkcsIAlgorithmParameters.h>
31 #include <FSecPkcsAlgorithmIdentifier.h>
32 #include <FSecPkcsTypes.h>
34 namespace Tizen { namespace Security { namespace Pkcs
38 * @class Pkcs05PbEs2Parameters
39 * @brief This class implements the functionalities specified by the PKCS05 encryption scheme 2.
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.
48 * This is defined in ASN.1 as demonstrated in the following code:
50 * PBES2-params ::= SEQUENCE {
51 * keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},
52 * encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} }
57 class _OSP_EXPORT_ Pkcs05PbEs2Parameters
58 : public virtual IAlgorithmParameters
59 , public Tizen::Base::Object
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.
70 Pkcs05PbEs2Parameters(void);
73 * This destructor overrides Tizen::Base::Object::~Object().
77 virtual ~Pkcs05PbEs2Parameters(void);
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.
84 * @return An error code
85 * @param[in] encodedData 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.
89 result Construct(const Tizen::Base::ByteBuffer& encodedData);
92 * Initializes this %Pkcs05PbEs2Parameters with specified input parameters values.
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.
102 result Construct(const AlgorithmIdentifier& keyDerivationFunction, const AlgorithmIdentifier& encryptionScheme);
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.
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.
116 Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
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.
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.
127 const AlgorithmIdentifier& GetKeyDerivationAlgorithm(void) const;
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.
135 * @return A reference to AlgorithmIdentifier holding the underlying encryption algorithm
136 * @remarks The specific error code can be accessed using the GetLastResult() method.
138 const AlgorithmIdentifier& GetEncryptionScheme(void) const;
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.
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.
150 virtual IAlgorithmParameters* CloneN(void) const;
154 * Gets the PkcsAlgorithmParameterType value.
158 * @return PkcsAlgorithmParameterType holding enum value @c PKCS_ALGO_PARAM_TYPE_PKCS05_PBES02 for PBES2 Parameters
161 virtual PkcsAlgorithmParameterType GetType(void) const;
164 * Checks whether the specified instance of %Pkcs05PbEs2Parameters equals the current instance.
168 * @return @c true if the specified instance equals the current instance, @n
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.
175 virtual bool Equals(const Tizen::Base::Object& rhs) const;
178 * Gets the hash value of the current instance of %Pkcs05PbEs2Parameters.
182 * @return An integer value indicating the hash value of the current instance of %Pkcs05PbEs2Parameters
184 virtual int GetHashCode(void) const;
187 // This copy constructor is intentionally declared as private to prohibit @n
188 // copying of objects by users.
191 Pkcs05PbEs2Parameters(const Pkcs05PbEs2Parameters& rhs);
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.
198 Pkcs05PbEs2Parameters& operator =(const Pkcs05PbEs2Parameters& rhs);
201 class _Pkcs05PbEs2ParametersImpl* __pPkcs05PbEs2ParametersImpl;
202 friend class _Pkcs05PbEs2ParametersImpl;
203 }; //Pkcs05PbEs2Parameters
205 } } } // Tizen::Security::Pkcs
207 #endif // _FSEC_PKCS_PKCS_05_PBES2_PARAMETERS_H_