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 FSecPkcsAlgorithmIdentifier.h
20 * @brief This is the header file for the %AlgorithmIdentifier class.
22 * This header file contains the declarations of the %AlgorithmIdentifier class.
25 #ifndef _FSEC_PKCS_ALGORITHM_IDENTIFIER_H_
26 #define _FSEC_PKCS_ALGORITHM_IDENTIFIER_H_
28 #include <FBaseByteBuffer.h>
29 #include <FSecPkcsIAlgorithmParameters.h>
31 namespace Tizen { namespace Security { namespace Pkcs
35 * @class AlgorithmIdentifier
36 * @brief This class implements the ASN.1 specified %AlgorithmIdentifier, which is used for
37 * creating the standard %AlgorithmIdentifier object.
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.
45 * This is defined in ASN.1 as demonstrated in the following code:
47 * AlgorithmIdentifier { ALGORITHM-IDENTIFIER:InfoObjectSet }
50 * algorithm ALGORITHM-IDENTIFIER.&id({InfoObjectSet}),
51 * parameters ALGORITHM-IDENTIFIER.&Type({InfoObjectSet}
52 * {@algorithm}) OPTIONAL }
53 * ALGORITHM-IDENTIFIER ::= TYPE-IDENTIFIER
58 class _OSP_EXPORT_ AlgorithmIdentifier
59 : public Tizen::Base::Object
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.
68 AlgorithmIdentifier(void);
71 * This destructor overrides Tizen::Base::Object::~Object().
75 virtual ~AlgorithmIdentifier(void);
78 * Initializes the %AlgorithmIdentifier with supplied input parameter values.
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.
92 result Construct(const Tizen::Base::String& objectId, const IAlgorithmParameters* pParams = null);
95 * Initializes this instance of %AlgorithmIdentifier with the DER encoded Tizen::Base::Bytebuffer that conatins @n
96 * the ASN.1 specified %AlgorithmIdentifier structure.
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.
105 result Construct(const Tizen::Base::ByteBuffer& encodedData);
108 * Checks whether the specified instance of %AlgorithmIdentifier equals the current instance.
112 * @return @c true if the specified instance equals the current instance, @n
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.
119 virtual bool Equals(const Tizen::Base::Object& rhs) const;
122 * Gets the hash value of the current instance of %AlgorithmIdentifier.
126 * @return An integer value indicating the hash value of the current instance of %AlgorithmIdentifier
128 virtual int GetHashCode(void) const;
131 * Gets the copy of %AlgorithmIdentifier instance.
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.
139 AlgorithmIdentifier* CloneN(void) const;
142 * Gets the parameters of algorithm.
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.
150 IAlgorithmParameters* GetParametersN(void) const;
153 * Gets the object ID value of an algorithm in string format.
157 * @return Object ID of %AlgorithmIdentifier in string format like 1.2.3.4
160 Tizen::Base::String GetAlgorithmObjectId(void) const;
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.
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.
174 Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
177 // This copy constructor is intentionally declared as private to prohibit @n
178 // copying of objects by users.
181 AlgorithmIdentifier(const AlgorithmIdentifier& rhs);
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.
188 AlgorithmIdentifier& operator =(const AlgorithmIdentifier& rhs);
191 class _AlgorithmIdentifierImpl* __pAlgorithmIdentifierImpl;
192 friend class _AlgorithmIdentifierImpl;
193 }; // AlgorithmIdentifier
195 } } } // Tizen::Security::Pkcs
197 #endif //_FSEC_PKCS_ALGORITHM_IDENTIFIER_H_