2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSecPkcsRc2CbcParameters.h
19 * @brief This is the header file for the %Rc2CbcParameters class.
21 * This header file contains the declarations of the %Rc2CbcParameters class.
24 #ifndef _FSEC_PKCS_RC2_CBC_PARAMETERS_H_
25 #define _FSEC_PKCS_RC2_CBC_PARAMETERS_H_
27 #include <FBaseByteBuffer.h>
28 #include <FSecPkcsIAlgorithmParameters.h>
29 #include <FSecPkcsTypes.h>
31 namespace Tizen { namespace Security { namespace Pkcs
35 * @class Rc2CbcParameters
36 * @brief This class implements the functionalities specified by the Rc2 Cbc mode parameter.
40 * The %Rc2CbcParameters class implements the functionalities specified by the Rc2 Cbc mode parameter.
41 * This class represents the Rc2 cbc mode parameter for symmetric ciphers RC2.
42 * ASN.1 format for RC2-CBC-Parameter ::= SEQUENCE {
43 * rc2ParameterVersion INTEGER OPTIONAL,
44 * 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();
70 * Initializes this instance of %Rc2CbcParameters with the values of the specified input parameters.
74 * @return An error code
75 * @param[in] initialVector An instance of Tizen::Base::ByteBuffer containing the initial vector
76 * @param[in] version An integer value that defines the rc2 cbc parameter version @n
77 * As per Pkcs 5 standard, possible values 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 A specified input parameter is invalid.
82 result Construct(const Tizen::Base::ByteBuffer& initialVector, int version = 0);
85 * Gets a copy of this instance.
89 * @return A pointer to IAlgorithmParameters, containing a copy of this instance
90 * @remarks The specific error code can be accessed using the GetLastResult() method.
92 virtual IAlgorithmParameters* CloneN(void) const;
95 * Gets the algorithm parameter type enum value for %Rc2CbcParameters.
99 * @return An enum value containing the @c 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 * Gets the rc2 cbc parameter version value.
132 * @return An integer value that contains the rc2 cbc parameter version
135 int GetVersion(void) const;
138 * Gets an instance of Tizen::Base::ByteBuffer that contains the initial vector value.
142 * @return A reference to Tizen::Base::ByteBuffer containing the initial vector data
145 const Tizen::Base::ByteBuffer& GetInitialVector(void) const;
148 * Gets the encoded form of %Rc2CbcParameters. @n
149 * It is assumed that each %Rc2CbcParameters type will have only a single form of encoding that is DER encoding.
153 * @return A pointer to the DER encoded Tizen::Base::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_