Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / inc / FSecPkcsRc2CbcParameters.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                FSecPkcsRc2CbcParameters.h
19  * @brief               This is the header file for the %Rc2CbcParameters class.
20  *
21  * This header file contains the declarations of the %Rc2CbcParameters class.
22  */
23
24 #ifndef _FSEC_PKCS_RC2_CBC_PARAMETERS_H_
25 #define _FSEC_PKCS_RC2_CBC_PARAMETERS_H_
26
27 #include <FBaseByteBuffer.h>
28 #include <FSecPkcsIAlgorithmParameters.h>
29 #include <FSecPkcsTypes.h>
30
31 namespace Tizen { namespace Security { namespace Pkcs
32 {
33
34 /**
35  * @class               Rc2CbcParameters
36  * @brief               This class implements the functionalities specified by the Rc2 Cbc mode parameter.
37  *
38  * @since               2.1
39  *
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)) }
45  *
46  */
47
48 class _OSP_EXPORT_ Rc2CbcParameters
49         : public virtual IAlgorithmParameters
50         , public Tizen::Base::Object
51 {
52
53 public:
54         /**
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.
57          *
58          * @since               2.1
59          */
60         Rc2CbcParameters(void);
61
62         /**
63          * This destructor overrides Tizen::Base::Object::~Object().
64          *
65          * @since               2.1
66          */
67         virtual ~Rc2CbcParameters();
68
69         /**
70          * Initializes this instance of %Rc2CbcParameters with the values of the specified input parameters.
71          *
72          * @since               2.1
73          *
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.
81          */
82         result Construct(const Tizen::Base::ByteBuffer& initialVector, int version = 0);
83
84         /**
85          * Gets a copy of this instance.
86          *
87          * @since               2.1
88          *
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.
91          */
92         virtual IAlgorithmParameters* CloneN(void) const;
93
94         /**
95          * Gets the algorithm parameter type enum value for %Rc2CbcParameters.
96          *
97          * @since               2.1
98          *
99          * @return              An enum value containing the @c PKCS_ALGO_PARAM_TYPE_RC2 value for %Rc2CbcParameters parameter
100          *
101          */
102         virtual PkcsAlgorithmParameterType GetType(void) const;
103
104         /**
105          * Checks whether the specified instance of %Rc2CbcParameters equals the current instance.
106          *
107          * @since               2.1
108          *
109          * @return              @c true if the specified instance equals the current instance, @n
110          *                              else @c false
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.
115         */
116         virtual bool Equals(const Tizen::Base::Object& rhs) const;
117
118         /**
119          * Gets the hash value of the current instance of %Rc2CbcParameters.
120          *
121          * @since               2.1
122          *
123          * @return              An integer value indicating the hash value of the current instance of %Rc2CbcParameters
124          */
125         virtual int GetHashCode(void) const;
126
127         /**
128          * Gets the rc2 cbc parameter version value.
129          *
130          * @since               2.1
131          *
132          * @return              An integer value that contains the rc2 cbc parameter version
133          *
134          */
135         int GetVersion(void) const;
136
137         /**
138          * Gets an instance of Tizen::Base::ByteBuffer that contains the initial vector value.
139          *
140          * @since               2.1
141          *
142          * @return              A reference to Tizen::Base::ByteBuffer containing the initial vector data
143          *
144          */
145         const Tizen::Base::ByteBuffer& GetInitialVector(void) const;
146
147         /**
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.
150          *
151          * @since               2.1
152          *
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.
158          */
159         Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
160
161 private:
162         // This copy constructor is intentionally declared as private to prohibit @n
163         // copying of objects by users.
164         //
165         // @since               2.1
166         Rc2CbcParameters(const Rc2CbcParameters& rhs);
167
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.
170         //
171         // @since               2.1
172         Rc2CbcParameters& operator =(const Rc2CbcParameters& rhs);
173
174 private:
175         class _Rc2CbcParametersImpl* __pRc2CbcParametersImpl;
176         friend class _Rc2CbcParametersImpl;
177
178 }; // Rc2CbcParameters
179
180 } } } // Tizen::Security::Pkcs
181
182 #endif // _FSEC_PKCS_RC2_CBC_PARAMETERS_H_