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.
40 * PBES2 combines a password-based key derivation function, which shall be PBKDF2
41 * for PKCS #5 version 2.1, with an underlying encryption scheme
42 * The key length and any other parameters for the underlying encryption scheme depend on the scheme.
44 * It is defined in ASN.1 as:
46 * PBES2-params ::= SEQUENCE {
47 * keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},
48 * encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} }
53 class _OSP_EXPORT_ Pkcs05PbEs2Parameters
54 : public virtual IAlgorithmParameters
55 , public Tizen::Base::Object
61 * The object is not fully constructed after this constructor is called. @n
62 * For full construction, the Construct() method must be called right after calling this constructor.
66 Pkcs05PbEs2Parameters(void);
69 * This destructor overrides Tizen::Base::Object::~Object().
73 virtual ~Pkcs05PbEs2Parameters(void);
76 * Initializes this instance of %Pkcs05PbEs2Parameters with the encoded Bytebuffer which contain Password based encryption @n
77 * parameters structure(PBES2) in ASN.1 DER format.
81 * @return An error code
82 * @param[in] encodedData DER encoded Bytebuffer contains Pkcs05PbEs2Parameters.
83 * @exception E_SUCCESS The method is successful.
84 * @exception E_INVALID_ARG The specified input parameter is invalid.
86 result Construct(const Tizen::Base::ByteBuffer& encodedData);
89 * Initializes the %Pkcs05PbEs2Parameters with supplied input parameters values.
93 * @return An error code
94 * @param[in] keyDerivationFunction An instance of AlgorithmIdentifier, holding key derivation function.
95 * @param[in] encryptionScheme An instance of AlgorithmIdentifier, holding encryption scheme.
96 * @exception E_SUCCESS The method is successful.
97 * @exception E_INVALID_ARG The specified input parameter is invalid.
99 result Construct(const AlgorithmIdentifier& keyDerivationFunction, const AlgorithmIdentifier& encryptionScheme);
102 * Gets the encoded form of the Pkcs05PbEs2Parameters.
103 * It is assumed that each Pkcs05PbEs2Parameters will have only a single form of encoding example ASN.1 DER.
107 * @return A pointer to the ByteBuffer class that contains the output, @n
108 * else @c null if an error occurs.
109 * @exception E_SUCCESS The method is successful.
110 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
111 * @remarks The specific error code can be accessed using the GetLastResult() method.
113 Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
116 * Get the reference to the AlgorithmIdentifier instance which identifies the underlying key derivation function.
117 * It shall be an algorithm ID with an OID in the set PBES2-KDFs, which for this version of PKCS #5 shall consist of id-PBKDF2.
121 * @return A reference to AlgorithmIdentifier holding the underlying key derivation function.
122 * @remarks The specific error code can be accessed using the GetLastResult() method.
124 const AlgorithmIdentifier& GetKeyDerivationAlgorithm(void) const;
127 * Get the reference to the AlgorithmIdentifier instance which identifies the underlying encryption algorithm.
128 * It shall be an OID in the set PBES2-Encs, whose definition is left to the application.
132 * @return A reference to AlgorithmIdentifier holding the underlying encryption algorithm.
133 * @remarks The specific error code can be accessed using the GetLastResult() method.
135 const AlgorithmIdentifier& GetEncryptionScheme(void) const;
138 * Get the AlgorithmParameters which identifies the underlying Parameters like PbKdf2,PbEs2,PbMac1.
139 * For this class AlgorithmParameters will be of Pbes2 type.
143 * @return A pointer to IAlgorithmParameters containing the algorithm identifier of underlying pseudo random function, @n
144 * else @c null if an error occurs.
145 * @remarks The specific error code can be accessed using the GetLastResult() method.
147 virtual IAlgorithmParameters* CloneN(void) const;
151 * Get the PkcsAlgorithmParameterType value.
155 * @return PkcsAlgorithmParameterType holding enum value PKCS_ALGO_PARAM_TYPE_PKCS05_PBES02 for PBES2 Parameters.
158 virtual PkcsAlgorithmParameterType GetType(void) const;
161 * Checks whether the specified instance of %Pkcs05PbEs2Parameters equals the current instance.
165 * @return @c true if the specified instance equals the current instance, @n
167 * @param[in] rhs An instance of %Pkcs05PbEs2Parameters
168 * @exception E_SUCCESS The method is successful.
169 * @exception E_INVALID_ARG The specified input parameter is invalid.
170 * @remarks The specific error code can be accessed using the GetLastResult() method.
172 virtual bool Equals(const Tizen::Base::Object& rhs) const;
175 * Gets the hash value of the current instance of %Pkcs05PbEs2Parameters.
179 * @return An integer value indicating the hash value of the current instance of %Pkcs05PbEs2Parameters
181 virtual int GetHashCode(void) const;
184 // This copy constructor is intentionally declared as private to prohibit @n
185 // copying of objects by users.
188 Pkcs05PbEs2Parameters(const Pkcs05PbEs2Parameters& rhs);
190 // The implementation of this copy assignment operator is intentionally blank and @n
191 // declared as private to prohibit copying of objects.Use CloneN() to get an exact copy of the instance. @n
192 // Use Equals() to compare the contents of one instance with the other.
195 Pkcs05PbEs2Parameters& operator =(const Pkcs05PbEs2Parameters& rhs);
198 class _Pkcs05PbEs2ParametersImpl* __pPkcs05PbEs2ParametersImpl;
199 friend class _Pkcs05PbEs2ParametersImpl;
200 }; //Pkcs05PbEs2Parameters
202 } } } // Tizen::Security::Pkcs
204 #endif // _FSEC_PKCS_PKCS_05_PBES2_PARAMETERS_H_