* @param[in] message The message that is signed with a private key
* @param[in] hash The hash algorithm used in creating signature
* @param[in] padding The RSA padding algorithm used in creating signature \n
- * It is used only when the signature algorithm is RSA
+ * It is used only when the signature algorithm is RSA. If
+ * @a padding is CKMC_NONE_PADDING you must use CKMC_HASH_NONE
+ * and the message must be equal to key length
* @param[out] ppsignature The pointer to a newly created signature \n
* If an error occurs, @a *ppsignature will be null
* @return @c 0 on success,
* @param[in] signature The signature that is verified with public key
* @param[in] hash The hash algorithm used in verifying signature
* @param[in] padding The RSA padding algorithm used in verifying signature \n
- * It is used only when the signature algorithm is RSA
+ * It is used only when the signature algorithm is RSA. If
+ * @a padding is CKMC_NONE_PADDING you must use CKMC_HASH_NONE
+ * and the message must be equal to key length
* @return @c 0 on success and the signature is valid,
* otherwise a negative error value
* @retval #CKMC_ERROR_NONE Successful
/* Set padding algorithm */
if (EVP_PKEY_type(privKey->type) == EVP_PKEY_RSA)
if (EVP_SUCCESS != EVP_PKEY_CTX_set_rsa_padding(pctx.get(), rsa_padding))
- ThrowErr(Exc::Crypto::InternalError,
+ ThrowErr(Exc::Crypto::InputParam,
"Error in EVP_PKEY_CTX_set_rsa_padding function");
/* Finalize the Sign operation */
/* Set padding algorithm */
if (EVP_PKEY_type(privKey->type) == EVP_PKEY_RSA)
if (EVP_SUCCESS != EVP_PKEY_CTX_set_rsa_padding(pctx, rsa_padding))
- ThrowErr(Exc::Crypto::InternalError,
+ ThrowErr(Exc::Crypto::InputParam,
"Error in EVP_PKEY_CTX_set_rsa_padding function");
/* Call update with the message */
/* Set padding algorithm */
if (EVP_PKEY_type(pubKey->type) == EVP_PKEY_RSA)
if (EVP_SUCCESS != EVP_PKEY_CTX_set_rsa_padding(pctx.get(), rsa_padding))
- ThrowErr(Exc::Crypto::InternalError,
+ ThrowErr(Exc::Crypto::InputParam,
"Error in EVP_PKEY_CTX_set_rsa_padding function");
if (EVP_SUCCESS == EVP_PKEY_verify(pctx.get(), signature.data(),
if (EVP_PKEY_type(pubKey->type) == EVP_PKEY_RSA)
if (EVP_SUCCESS != EVP_PKEY_CTX_set_rsa_padding(pctx, rsa_padding))
- ThrowErr(Exc::Crypto::InternalError,
+ ThrowErr(Exc::Crypto::InputParam,
"Error in EVP_PKEY_CTX_set_rsa_padding function");
if (EVP_SUCCESS != EVP_DigestVerifyUpdate(mdctx.get(), message.data(),