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 FSecPkcsRc2CbcParameters.h
20 * @brief This is the header file for the %PkcsRc2CbcParametersr class.
22 * This header file contains the declarations of the %PkcsRc2CbcParameters class.
25 #ifndef _FSEC_PKCS_RC2_CBC_PARAMETERS_H_
26 #define _FSEC_PKCS_RC2_CBC_PARAMETERS_H_
28 #include <FBaseByteBuffer.h>
29 #include <FSecPkcsIAlgorithmParameters.h>
30 #include <FSecPkcsTypes.h>
32 namespace Tizen { namespace Security { namespace Pkcs
36 * @class Rc2CbcParameters
37 * @brief This class implements the functionalities specified by the Rc2 Cbc mode parameter.
38 * @brief This class implements the functionalities specified by the Rc2 Cbc mode parameter.
39 * This class represents the Rc2 cbc mode parameter for symmetric ciphers RC2.
40 * ASN.1 format for RC2-CBC-Parameter ::= SEQUENCE {
41 * rc2ParameterVersion INTEGER OPTIONAL,
42 * iv OCTET STRING (SIZE(8)) }
48 class _OSP_EXPORT_ Rc2CbcParameters
49 : public virtual IAlgorithmParameters
50 , public Tizen::Base::Object
55 * The object is not fully constructed after this constructor is called. @n
56 * For full construction, the Construct() method must be called right after calling this constructor.
60 Rc2CbcParameters(void);
63 * This destructor overrides Tizen::Base::Object::~Object().
67 virtual ~Rc2CbcParameters(void);
70 * Initializes this instance of %Rc2CbcParameters with supplied input parameters values.
74 * @return An error code
75 * @param[in] initialVector An instance of ByteBuffer containing the initial vector.
76 * @param[in] version An integer value defines the rc2 cbc parameter version.
77 * As per Pkcs 5 standard, possible value can be 160,120,58 or any value
78 * greater than or equal to 256.
79 * @exception E_SUCCESS The method is successful.
80 * @exception E_INVALID_ARG The specified input parameter is invalid.
82 result Construct(const Tizen::Base::ByteBuffer& initialVector, int version = 0);
85 * Get the copy of this instance.
89 * @return A pointer to IAlgorithmParameters, containing the copy of this instance.
90 * @remarks The specific error code can be accessed using the GetLastResult() method.
92 virtual IAlgorithmParameters* CloneN(void) const;
95 * Get the algorithm parameter type enum value for Rc2CbcParameters.
99 * @return PkcsAlgorithmParameterType Enum value containing the PKCS_ALGO_PARAM_TYPE_RC2 value for Rc2CbcParameters parameter.
102 virtual PkcsAlgorithmParameterType GetType(void) const;
105 * Checks whether the specified instance of %Rc2CbcParameters equals the current instance.
109 * @return @c true if the specified instance equals the current instance, @n
111 * @param[in] rhs An instance of %Rc2CbcParameters
112 * @exception E_SUCCESS The method is successful.
113 * @exception E_INVALID_ARG The specified input parameter is invalid.
114 * @remarks The specific error code can be accessed using the GetLastResult() method.
116 virtual bool Equals(const Tizen::Base::Object& rhs) const;
119 * Gets the hash value of the current instance of %Rc2CbcParameters.
123 * @return An integer value indicating the hash value of the current instance of %Rc2CbcParameters
125 virtual int GetHashCode(void) const;
128 * Get the rc2 cbc parameter version value.
132 * @return An integer value that contains the rc2 cbc parameter version.
135 int GetVersion(void) const;
138 * Get the instance of byte buffer that contains the Initial Vector value.
142 * @return A reference to ByteBuffer , containing the initial vector data.
145 const Tizen::Base::ByteBuffer& GetInitialVector(void) const;
148 * Gets the encoded form of the Rc2CbcParameter. @n
149 * It is assumed that each Rc2CbcParameter type will have only a single form of encoding that is DER encoding.
153 * @return Pointer to the DER encoded ByteBuffer, @n
154 * else @c null if an error occurs.
155 * @exception E_SUCCESS The method is successful.
156 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
157 * @remarks The specific error code can be accessed using the GetLastResult() method.
159 Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
162 // This copy constructor is intentionally declared as private to prohibit @n
163 // copying of objects by users.
166 Rc2CbcParameters(const Rc2CbcParameters& rhs);
168 // The implementation of this copy assignment operator is intentionally blank and @n
169 // declared as private to prohibit copying of objects.Use GetCloneN() to get an exact copy of the instance.
172 Rc2CbcParameters& operator =(const Rc2CbcParameters& rhs);
175 class _Rc2CbcParametersImpl* __pRc2CbcParametersImpl;
176 friend class _Rc2CbcParametersImpl;
178 }; // Rc2CbcParameters
180 } } } // Tizen::Security::Pkcs
182 #endif // _FSEC_PKCS_RC2_CBC_PARAMETERS_H_