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.
38 * AlgorithmIdentifier structure consist the OID value of the Algorithm
39 * and the parameters of that algorithm.
41 * It is defined in ASN.1 as
43 * AlgorithmIdentifier { ALGORITHM-IDENTIFIER:InfoObjectSet }
46 * algorithm ALGORITHM-IDENTIFIER.&id({InfoObjectSet}),
47 * parameters ALGORITHM-IDENTIFIER.&Type({InfoObjectSet}
48 * {@algorithm}) OPTIONAL }
49 * ALGORITHM-IDENTIFIER ::= TYPE-IDENTIFIER
54 class _OSP_EXPORT_ AlgorithmIdentifier
55 : public Tizen::Base::Object
59 * The object is not fully constructed after this constructor is called. @n
60 * For full construction, the Construct() method must be called right after calling this constructor.
64 AlgorithmIdentifier(void);
67 * This destructor overrides Tizen::Base::Object::~Object().
71 virtual ~AlgorithmIdentifier(void);
74 * Initializes the %AlgorithmIdentifier with supplied input parameters values.
78 * @return An error code
79 * @param[in] objectId This parameter specifies object Identifier of particular algorithm. Object IDs
80 * are defined by standard bodies for algorithms and other crypto objects.Object ID of AlgorithmIdentifier can be described in string format like 1.2.3.4
81 * @param[in] pParams This parameter specifies a pointer to AlgorithmParameters object. This is an
82 * optional parameter and contains a list of user supplied input parameters for the specified algorithm.
83 * For example, for Symmetric algorithms Initial vector (IV) is required as input.
84 * The default value of this parameter is NULL.
85 * @exception E_SUCCESS The method is successful.
86 * @exception E_INVALID_ARG The specified input parameter is invalid.
87 * @exception E_UNSUPPORTED_ALGORITHM The object id of the input algorithm is not supported.
89 result Construct(const Tizen::Base::String& objectId, const IAlgorithmParameters* pParams = null);
92 * Initializes this instance of %AlgorithmIdentifier with the DER encoded Bytebuffer that conatins @n
93 * the ASN.1 specified AlgorithmIdentifier structure.
97 * @return An error code
98 * @param[in] encodedData An instance of DER encoded ByteBuffer
99 * @exception E_SUCCESS The method is successful.
100 * @exception E_INVALID_ARG The specified input parameter is invalid.
102 result Construct(const Tizen::Base::ByteBuffer& encodedData);
105 * Checks whether the specified instance of %AlgorithmIdentifier equals the current instance.
109 * @return @c true if the specified instance equals the current instance, @n
111 * @param[in] rhs An instance of %AlgorithmIdentifier
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 %AlgorithmIdentifier.
123 * @return An integer value indicating the hash value of the current instance of %AlgorithmIdentifier
125 virtual int GetHashCode(void) const;
128 * Get the copy of AlgorithmIdentifier instance.
132 * @return Pointer to AlgorithmIdentifier, containing the copy of this instance, @n
133 * else @c null if an error occurs.
134 * @remarks The specific error code can be accessed using the GetLastResult() method.
136 AlgorithmIdentifier* CloneN(void) const;
139 * Gets the parameters of algorithm.
143 * @return Pointer to IAlgorithmParameters, containing the parameter list of algorithm, @n
144 * else @c null if an no parameters exist.
145 * @remarks The specific error code can be accessed using the GetLastResult() method.
147 IAlgorithmParameters* GetParametersN(void) const;
150 * Gets the object Id value of an algorithm in string format.
154 * @return Object ID of AlgorithmIdentifier in string format like 1.2.3.4.
157 Tizen::Base::String GetAlgorithmObjectId(void) const;
160 * Gets the encoded form of the AlgorithmIdentifier. @n
161 * It is assumed that each AlgorithmIdentifier type will have only a single form of encoding that is DER encoding.
165 * @return Pointer to the DER encoded ByteBuffer, @n
166 * else @c null if an error occurs.
167 * @exception E_SUCCESS The method is successful.
168 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
169 * @remarks The specific error code can be accessed using the GetLastResult() method.
171 Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
174 // This copy constructor is intentionally declared as private to prohibit @n
175 // copying of objects by users.
178 AlgorithmIdentifier(const AlgorithmIdentifier& rhs);
180 // The implementation of this copy assignment operator is intentionally blank and @n
181 // declared as private to prohibit copying of objects.Use CloneN() to get an exact copy of the instance. @n
182 // Use Equals() to compare the contents of one instance with the other.
185 AlgorithmIdentifier& operator =(const AlgorithmIdentifier& rhs);
188 class _AlgorithmIdentifierImpl* __pAlgorithmIdentifierImpl;
189 friend class _AlgorithmIdentifierImpl;
190 }; // AlgorithmIdentifier
192 } } } // Tizen::Security::Pkcs
194 #endif //_FSEC_PKCS_ALGORITHM_IDENTIFIER_H_