//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
*
* The %RsaSignature class implements the Rivest Shamir Adleman (RSA) signatures. @n
*
- * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/ciphers.htm">Ciphers</a>.
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/ciphers.htm">Ciphers</a>.
*
* @see ISignature
* @see IKeyPairGenerator
virtual ~RsaSignature(void);
/**
- * Sets an asymmetric private key for signature.
+ * Sets the asymmetric private key for signature.
*
* @since 2.0
*
* @return An error code
* @param[in] key An instance of IKey
+ * The key can be in PEM/DER/PKCS8 format only.
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified @c key is invalid.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
virtual result SetPrivateKey(const Tizen::Security::IKey& key);
/**
- * Sets an asymmetric public key for verification.
+ * Sets the asymmetric public key for verification.
*
* @since 2.0
*
* @return An error code
* @param[in] key An instance of IKey
+ * The key can be in PEM/DER/X509 public key format only.
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified @c key is invalid.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
virtual result SetPublicKey(const Tizen::Security::IKey& key);
/**
- * Signs the data.
- *
+ * Signs the data. @n
+ * The %SignN() method only supports sha1withRsa for signing the data
* @since 2.0
*
- * @return A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
+ * @return A pointer to the Tizen::Base::ByteBuffer instance that contains the output, @n
* else @c null if an error occurs
- * @param[in] input An instance of Tizen::Base::ByteBuffer
+ * @param[in] input An instance of Tizen::Base::ByteBuffer
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The input Tizen::Base::ByteBuffer is empty or contains invalid data.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_KEY_NOT_FOUND The specified key is not found.
- * @exception E_SYSTEM A system error has occurred. @n
- * The method has failed to operate with the OpenSSL library, or
- * the Tizen::Base::ByteBuffer operation has failed.
- * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @exception E_SYSTEM Either of the following conditions has occurred:
+ * - A system error has occurred.
+ * - The method has failed to operate with the OpenSSL library.
+ * - The Tizen::Base::ByteBuffer operation has failed.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
*/
virtual Tizen::Base::ByteBuffer* SignN(const Tizen::Base::ByteBuffer& input);
/**
+ * Signs the data. @n
+ * The %SignN() method provides the additional option for setting the digest algorithm that is needed for signing the data
+ *
+ * @since 2.0
+ *
+ * @return A pointer to the Tizen::Base::ByteBuffer instance that contains the output, @n
+ * else @c null if an error occurs
+ * @param[in] input An instance of Tizen::Base::ByteBuffer
+ * @param[in] algorithm The Tizen::Base::String instance that contains the digest algorithm. @n
+ * The valid values are MD5, MD5WITHSHA1, SHA1, SHA2/224, SHA2/256, SHA2/384, SHA2/512.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The input Tizen::Base::ByteBuffer is empty or contains invalid data.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_KEY_NOT_FOUND The specified key is not found.
+ * @exception E_UNSUPPORTED_ALGORITHM The specified algorithm is not supported.
+ * @exception E_SYSTEM Either of the following conditions has occurred:
+ * - A system error has occurred.
+ * - The method has failed to operate with the OpenSSL library.
+ * - The Tizen::Base::ByteBuffer operation has failed.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Base::ByteBuffer* SignN(const Tizen::Base::ByteBuffer& input, const Tizen::Base::String& algorithm);
+
+ /**
* Verifies the data. @n
- * The verification is done by comparing the @c signedData to the signature created by the @c data.
+ * The verification is done by comparing the @c signedData to the signature created by the @c data. @
+ * The %Verify() method only supports sha1withRsa for verifying the signed data
*
* @since 2.0
*
* @return @c true if the signed data is correct, @n
* else @c false
* @param[in] data An instance of Tizen::Base::ByteBuffer that contains the original data
- * @param[in] signedData A instance of Tizen::Base::ByteBuffer that contains the signed data
+ * @param[in] signedData An instance of Tizen::Base::ByteBuffer that contains the signed data
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The input Tizen::Base::ByteBuffer is empty or contains invalid data.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_KEY_NOT_FOUND The specified key is not found.
- * @exception E_SYSTEM A system error has occurred. @n
- * The method has failed to operate with the OpenSSL library, or
- * the Tizen::Base::ByteBuffer operation has failed.
- * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @exception E_SYSTEM Either of the following conditions has occurred:
+ * - A system error has occurred.
+ * - The method has failed to operate with the OpenSSL library.
+ * - The Tizen::Base::ByteBuffer operation has failed.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
*/
virtual bool Verify(const Tizen::Base::ByteBuffer& data, const Tizen::Base::ByteBuffer& signedData);
+ /**
+ * Verifies the data. @n
+ * The verification is done by comparing the @c signedData to the signature created by the @c data. @n
+ * The %Verify() method provides the additional option for setting the digest algorithm that is needed for verifying the signed data
+ *
+ * @since 2.0
+ *
+ * @return @c true if the signed data is correct, @n
+ * else @c false
+ * @param[in] data An instance of Tizen::Base::ByteBuffer that contains the original data
+ * @param[in] signedData An instance of Tizen::Base::ByteBuffer that contains the signed data
+ * @param[in] algorithm The Tizen::Base::String instance that contains the digest algorithm. @n
+ * The valid values are MD5, MD5WITHSHA1, SHA1, SHA2/224, SHA2/256, SHA2/384, SHA2/512.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The input Tizen::Base::ByteBuffer is empty or contains invalid data.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_KEY_NOT_FOUND The specified key is not found.
+ * @exception E_UNSUPPORTED_ALGORITHM The specified algorithm is not supported.
+ * @exception E_SYSTEM Either of the following conditions has occurred:
+ * - A system error has occurred.
+ * - The method has failed to operate with the OpenSSL library.
+ * - The Tizen::Base::ByteBuffer operation has failed.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ bool Verify(const Tizen::Base::ByteBuffer& data, const Tizen::Base::ByteBuffer& signedData, const Tizen::Base::String& algorithm);
+
private:
//