2 // Open Service Platform
3 // Copyright (c) 2012 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 FSecCryptoMd5Hash.h
20 * @brief This is the header file for the %Md5Hash class.
22 * This header file contains the declarations of the %Md5Hash class.
24 #ifndef _FSEC_CRYPTO_MD5_HASH_H_
25 #define _FSEC_CRYPTO_MD5_HASH_H_
27 #include <FSecCryptoIHash.h>
32 namespace Tizen { namespace Security { namespace Crypto
37 * @brief This class implements the MD5 hash algorithm.
41 * The %Md5Hash class implements the basic hash procedure to encrypt messages using the Message-Digest 5 hash algorithm. @n
43 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/hashing.htm">Hashing</a>.
49 class _OSP_EXPORT_ Md5Hash
50 : public virtual IHash
51 , public Tizen::Base::Object
56 * This is the default constructor for this class.
63 * This destructor overrides Tizen::Base::Object::~Object().
67 virtual ~Md5Hash(void);
70 * Sets the hash algorithm. @n
71 * The %SetAlgorithm() method is not supported by this class. Do not call this method.
72 * If this method is called, it returns @c E_UNSUPPORTED_ALGORITHM.
76 * @return An error code
77 * @param[in] algorithm The name of the hash algorithm @n
78 * For example, "SHA2/224", "SHA2/256", "SHA2/384", or "SHA2/512".
79 * @exception E_SUCCESS The method is successful.
80 * @exception E_UNSUPPORTED_ALGORITHM The algorithm is not supported.
81 * @remarks Do not call this method. It is not supported.
83 virtual result SetAlgorithm(const Tizen::Base::String& algorithm);
86 * Gets the hashes of the data (single-part).
90 * @return A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
91 * else @c null if an error occurs
92 * @param[in] input An instance of Tizen::Base::ByteBuffer
93 * @exception E_SUCCESS The method is successful.
94 * @exception E_INVALID_ARG The input Tizen::Base::ByteBuffer is empty or contains invalid data.
95 * @exception E_OUT_OF_MEMORY The memory is insufficient.
96 * @exception E_SYSTEM A system error has occurred. @n
97 * The method has failed to operate with the openssl library, or
98 * the Tizen::Base::ByteBuffer operation has failed.
99 * @remarks The specific error code can be accessed using the GetLastResult() method.
101 virtual Tizen::Base::ByteBuffer* GetHashN(const Tizen::Base::ByteBuffer& input) const;
104 * Initializes a multiple-part hash operation.
108 * @return An error code
109 * @exception E_SUCCESS The method is successful.
110 * @exception E_OUT_OF_MEMORY The memory is insufficient.
111 * @exception E_SYSTEM A system error has occurred. @n
112 * The method has failed to operate with the openssl library.
114 virtual result Initialize(void);
117 * Updates a multiple-part hash operation while processing another data part.
121 * @return An error code
122 * @param[in] input An instance of Tizen::Base::ByteBuffer
123 * @exception E_SUCCESS The method is successful.
124 * @exception E_INVALID_ARG The input Tizen::Base::ByteBuffer is empty or contains invalid data.
125 * @exception E_OUT_OF_MEMORY The memory is insufficient.
126 * @exception E_SYSTEM A system error has occurred. @n
127 * The method has failed to operate with the openssl library, or
128 * the Tizen::Base::ByteBuffer operation has failed.
130 virtual result Update(const Tizen::Base::ByteBuffer& input);
133 * Finalizes a multiple-part hash operation.
137 * @return A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
138 * else @c null if an error occurs
139 * @exception E_SUCCESS The method is successful.
140 * @exception E_OUT_OF_MEMORY The memory is insufficient.
141 * @exception E_SYSTEM A system error has occurred. @n
142 * The method has failed to operate with the openssl library, or
143 * the Tizen::Base::ByteBuffer operation has failed.
144 * @remarks The specific error code can be accessed using the GetLastResult() method.
146 virtual Tizen::Base::ByteBuffer* FinalizeN(void);
151 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
155 Md5Hash(const Md5Hash& rhs);
158 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
162 Md5Hash& operator =(const Md5Hash& rhs);
165 env_md_ctx_st* __pEvpMdCtx;
167 class _Md5HashImpl* __pMd5HashImpl;
168 friend class _Md5HashImpl;
172 } } } //Tizen::Security::Crypto
174 #endif //_FSEC_CRYPTO_MD5_HASH_H_