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 FSecPkcsAlgorithmIdentifier.h
19 * @brief This is the header file for the %AlgorithmIdentifier class.
21 * This header file contains the declarations of the %AlgorithmIdentifier class.
24 #ifndef _FSEC_PKCS_ALGORITHM_IDENTIFIER_H_
25 #define _FSEC_PKCS_ALGORITHM_IDENTIFIER_H_
27 #include <FBaseByteBuffer.h>
28 #include <FSecPkcsIAlgorithmParameters.h>
30 namespace Tizen { namespace Security { namespace Pkcs
34 * @class AlgorithmIdentifier
35 * @brief This class implements the ASN.1 specified %AlgorithmIdentifier, which is used for
36 * creating the standard %AlgorithmIdentifier object.
40 * The %AlgorithmIdentifier class implements the ASN.1 specified %AlgorithmIdentifier, which is used for
41 * creating the standard %AlgorithmIdentifier object. The %AlgorithmIdentifier structure consists of the OID value of the
42 * algorithm along with the parameters of the algorithm.
44 * This is defined in ASN.1 as demonstrated in the following code:
46 * AlgorithmIdentifier { ALGORITHM-IDENTIFIER:InfoObjectSet }
49 * algorithm ALGORITHM-IDENTIFIER.&id({InfoObjectSet}),
50 * parameters ALGORITHM-IDENTIFIER.&Type({InfoObjectSet}
51 * {@algorithm}) OPTIONAL }
52 * ALGORITHM-IDENTIFIER ::= TYPE-IDENTIFIER
57 class _OSP_EXPORT_ AlgorithmIdentifier
58 : public Tizen::Base::Object
62 * The object is not fully constructed after this constructor is called. @n
63 * For full construction, the Construct() method must be called right after calling this constructor.
67 AlgorithmIdentifier(void);
70 * This destructor overrides Tizen::Base::Object::~Object().
74 virtual ~AlgorithmIdentifier(void);
77 * Initializes the %AlgorithmIdentifier with the specified input parameter values.
81 * @return An error code
82 * @param[in] objectId The object identifier of a particular algorithm @n
83 * The object IDs are defined by standard bodies for algorithms and other crypto objects. @n
84 * The object ID of %AlgorithmIdentifier can be described in string format like 1.2.3.4
85 * @param[in] pParams A pointer to the AlgorithmParameters object @n
86 * This is an optional parameter and contains a list of user specified input parameters for
87 * the specified algorithm. For example, for Symmetric algorithms Initial vector, IV is required
88 * as an input. The default value of this parameter is @c null.
89 * @exception E_SUCCESS The method is successful.
90 * @exception E_INVALID_ARG The specified input parameter is invalid.
91 * @exception E_UNSUPPORTED_ALGORITHM The object ID of the input algorithm is not supported.
93 result Construct(const Tizen::Base::String& objectId, const IAlgorithmParameters* pParams = null);
96 * Initializes this instance of %AlgorithmIdentifier with the DER encoded Tizen::Base::ByteBuffer that contains
97 * the ASN.1 specified %AlgorithmIdentifier structure.
101 * @return An error code
102 * @param[in] encodedData An instance of DER encoded Tizen::Base::ByteBuffer
103 * @exception E_SUCCESS The method is successful.
104 * @exception E_INVALID_ARG The specified input parameter is invalid.
106 result Construct(const Tizen::Base::ByteBuffer& encodedData);
109 * Checks whether the specified instance of %AlgorithmIdentifier equals the current instance.
113 * @return @c true if the specified instance equals the current instance, @n
115 * @param[in] rhs An instance of %AlgorithmIdentifier
116 * @exception E_SUCCESS The method is successful.
117 * @exception E_INVALID_ARG The specified input parameter is invalid.
118 * @remarks The specific error code can be accessed using the GetLastResult() method.
120 virtual bool Equals(const Tizen::Base::Object& rhs) const;
123 * Gets the hash value of the current instance of %AlgorithmIdentifier.
127 * @return An integer value indicating the hash value of the current instance of %AlgorithmIdentifier
129 virtual int GetHashCode(void) const;
132 * Gets the copy of the %AlgorithmIdentifier instance.
136 * @return A pointer to the %AlgorithmIdentifier instance that is the copy of the specified instance, @n
137 * else @c null if an error occurs
138 * @remarks The specific error code can be accessed using the GetLastResult() method.
140 AlgorithmIdentifier* CloneN(void) const;
143 * Gets the parameters of algorithm.
147 * @return A pointer to the IAlgorithmParameters instance containing the parameter list of algorithm, @n
148 * else @c null if no parameters exist
149 * @remarks The specific error code can be accessed using the GetLastResult() method.
151 IAlgorithmParameters* GetParametersN(void) const;
154 * Gets the object ID value of an algorithm in string format.
158 * @return The object ID of %AlgorithmIdentifier in string format like 1.2.3.4
161 Tizen::Base::String GetAlgorithmObjectId(void) const;
164 * Gets the encoded form of the %AlgorithmIdentifier. @n
165 * It is assumed that each %AlgorithmIdentifier type will have only a single form of encoding that is DER encoding.
169 * @return A pointer to the DER encoded Tizen::Base::ByteBuffer, @n
170 * else @c null if an error occurs
171 * @exception E_SUCCESS The method is successful.
172 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
173 * @remarks The specific error code can be accessed using the GetLastResult() method.
175 Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
178 // This copy constructor is intentionally declared as private to prohibit @n
179 // copying of objects by users.
182 AlgorithmIdentifier(const AlgorithmIdentifier& rhs);
184 // The implementation of this copy assignment operator is intentionally blank and @n
185 // declared as private to prohibit copying of objects.Use CloneN() to get an exact copy of the instance. @n
186 // Use Equals() to compare the contents of one instance with the other.
189 AlgorithmIdentifier& operator =(const AlgorithmIdentifier& rhs);
192 class _AlgorithmIdentifierImpl* __pAlgorithmIdentifierImpl;
193 friend class _AlgorithmIdentifierImpl;
194 }; // AlgorithmIdentifier
196 } } } // Tizen::Security::Pkcs
198 #endif //_FSEC_PKCS_ALGORITHM_IDENTIFIER_H_