Merge "update doxygen comments" into tizen_2.1
[platform/framework/native/appfw.git] / inc / FSecPkcsAlgorithmIdentifier.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file                FSecPkcsAlgorithmIdentifier.h
20  * @brief               This is the header file for the %AlgorithmIdentifier class.
21  *
22  * This header file contains the declarations of the %AlgorithmIdentifier class.
23  */
24
25 #ifndef _FSEC_PKCS_ALGORITHM_IDENTIFIER_H_
26 #define _FSEC_PKCS_ALGORITHM_IDENTIFIER_H_
27
28 #include <FBaseByteBuffer.h>
29 #include <FSecPkcsIAlgorithmParameters.h>
30
31 namespace Tizen { namespace Security { namespace Pkcs
32 {
33
34 /**
35  * @class               AlgorithmIdentifier
36  * @brief               This class implements the ASN.1 specified %AlgorithmIdentifier, which is used for
37  *                              creating the standard %AlgorithmIdentifier object.
38  *
39  * @since               2.1
40  *
41  * The %AlgorithmIdentifier class implements the ASN.1 specified %AlgorithmIdentifier, which is used for
42  *                              creating the standard %AlgorithmIdentifier object.
43  *              %AlgorithmIdentifier structure consists the OID value of the algorithm along with the parameters of that algorithm.
44  *
45  *              This is defined in ASN.1 as demonstrated in the following code:
46  * @code
47  *              AlgorithmIdentifier { ALGORITHM-IDENTIFIER:InfoObjectSet }
48  *              ::=
49  *              SEQUENCE {
50  *              algorithm ALGORITHM-IDENTIFIER.&id({InfoObjectSet}),
51  *              parameters ALGORITHM-IDENTIFIER.&Type({InfoObjectSet}
52  *              {@algorithm}) OPTIONAL }
53  *              ALGORITHM-IDENTIFIER ::= TYPE-IDENTIFIER
54  * @endcode
55  *
56  */
57
58 class _OSP_EXPORT_ AlgorithmIdentifier
59         : public Tizen::Base::Object
60 {
61 public:
62         /**
63          * The object is not fully constructed after this constructor is called. @n
64          * For full construction, the Construct() method must be called right after calling this constructor.
65          *
66          * @since               2.1
67          */
68         AlgorithmIdentifier(void);
69
70         /**
71          * This destructor overrides Tizen::Base::Object::~Object().
72          *
73          * @since               2.1
74          */
75         virtual ~AlgorithmIdentifier(void);
76
77         /**
78          * Initializes the %AlgorithmIdentifier with supplied input parameter values.
79          *
80          * @since               2.1
81          *
82          * @return              An error code
83          * @param[in]   objectId                        The object identifier of a particular algorithm @n
84          *                                                                      Object IDs are defined by standard bodies for algorithms and other crypto objects.
85          *                                                                      Object ID of %AlgorithmIdentifier can be described in string format like 1.2.3.4
86          * @param[in]   pParams                         A pointer to the AlgorithmParameters object @n 
87          *                                                                      This is an optional parameter and contains a list of user specified input parameters for the specified algorithm. For example, for Symmetric algorithms Initial vector, IV is required as an input. The default value of this parameter is @c null.
88          * @exception   E_SUCCESS                                               The method is successful.
89          * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
90          * @exception   E_UNSUPPORTED_ALGORITHM         The object ID of the input algorithm is not supported.
91          */
92         result Construct(const Tizen::Base::String& objectId, const IAlgorithmParameters* pParams = null);
93
94         /**
95          * Initializes this instance of %AlgorithmIdentifier with the DER encoded Tizen::Base::ByteBuffer that contains @n
96          * the ASN.1 specified %AlgorithmIdentifier structure.
97          *
98          * @since               2.1
99          *
100          * @return              An error code
101          * @param[in]   encodedData                                     An instance of DER encoded Tizen::Base::ByteBuffer
102          * @exception   E_SUCCESS                                               The method is successful.
103          * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
104          */
105         result Construct(const Tizen::Base::ByteBuffer& encodedData);
106
107         /**
108          * Checks whether the specified instance of %AlgorithmIdentifier equals the current instance.
109          *
110          * @since                       2.1
111          *
112          * @return              @c true if the specified instance equals the current instance, @n
113          *            else @c false
114          * @param[in]   rhs                                                                     An instance of %AlgorithmIdentifier
115          * @exception   E_SUCCESS                               The method is successful.
116          * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
117          * @remarks             The specific error code can be accessed using the GetLastResult() method.
118          */
119         virtual bool Equals(const Tizen::Base::Object& rhs) const;
120
121         /**
122          * Gets the hash value of the current instance of %AlgorithmIdentifier.
123          *
124          * @since               2.1
125          *
126          * @return              An integer value indicating the hash value of the current instance of %AlgorithmIdentifier
127          */
128         virtual int GetHashCode(void) const;
129
130         /**
131          * Gets the copy of %AlgorithmIdentifier instance.
132          *
133          * @since               2.1
134          *
135          * @return              Pointer to %AlgorithmIdentifier, containing the copy of the specified instance, @n
136          *                                              else @c null if an error occurs
137          * @remarks             The specific error code can be accessed using the GetLastResult() method.
138          */
139         AlgorithmIdentifier* CloneN(void) const;
140
141         /**
142          * Gets the parameters of algorithm.
143          *
144          * @since               2.1
145          *
146          * @return              Pointer to IAlgorithmParameters, containing the parameter list of algorithm, @n
147          *                                              else @c null if an no parameters exist
148          * @remarks             The specific error code can be accessed using the GetLastResult() method.
149          */
150         IAlgorithmParameters* GetParametersN(void) const;
151
152         /**
153          * Gets the object ID value of an algorithm in string format.
154          *
155          * @since                       2.1
156          *
157          * @return              Object ID of %AlgorithmIdentifier in string format like 1.2.3.4
158          *
159          */
160         Tizen::Base::String GetAlgorithmObjectId(void) const;
161
162         /**
163          * Gets the encoded form of the %AlgorithmIdentifier. @n
164          * It is assumed that each %AlgorithmIdentifier type will have only a single form of encoding that is DER encoding.
165          *
166          * @since               2.1
167          *
168          * @return              Pointer to the DER encoded Tizen::Base::ByteBuffer, @n
169          *                                              else @c null if an error occurs
170          * @exception   E_SUCCESS                                               The method is successful.
171          * @exception   E_SYSTEM                                                The method cannot proceed due to a severe system error.
172          * @remarks             The specific error code can be accessed using the GetLastResult() method.
173          */
174         Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
175
176 private:
177         // This copy constructor is intentionally declared as private to prohibit @n
178         // copying of objects by users.
179         //
180         // @since               2.1
181         AlgorithmIdentifier(const AlgorithmIdentifier& rhs);
182
183         // The implementation of this copy assignment operator is intentionally blank and @n
184         // declared as private to prohibit copying of objects.Use CloneN() to get an exact copy of the instance. @n
185         // Use Equals() to compare the contents of one instance with the other.
186         //
187         // @since               2.1
188         AlgorithmIdentifier& operator =(const AlgorithmIdentifier& rhs);
189
190 private:
191         class _AlgorithmIdentifierImpl* __pAlgorithmIdentifierImpl;
192         friend class _AlgorithmIdentifierImpl;
193 }; // AlgorithmIdentifier
194
195 } } } // Tizen::Security::Pkcs
196
197 #endif //_FSEC_PKCS_ALGORITHM_IDENTIFIER_H_