[openssl-users] RSA sign message

Dr. Stephen Henson steve at openssl.org
Tue Jul 19 21:19:43 UTC 2016

On Tue, Jul 19, 2016, Gabriel Iva??cu wrote:

> Hi,
> I need to RSA sign a message using SHA256 as hash and PKCS1 v1.5 as padding.
> I am however confused about the *type* parameter of RSA_sign function [0]
> What is the value that I should use for *type* in my particular case?

If you want to hash and sign the hash you should use EVP functions such as
 EVP_DigestSign*() functions instead. If you already have the hash you can
use RSA_sign (though EVP_PKEY_sign() is preferred) the type parameter in
the NID of the digest algorithm, for SHA256 you use NID_sha256.

Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org

More information about the openssl-users mailing list