Hi all,
I have a doubt regarding EMSA-PKCS1-v1_5 usage in OpenSSL.

My requirement is that I want to sign some data using a specific Hash Algorithm (SHA1).

For this Iam trying to do the following steps instead of calling rsa_sign() function directly.

1. Calculate SHA1 Hash on the data to be signed.
2. Call RSA_private_encrypt with RSA_PKCS1_PADDING.

As per the documentation, this corresponds to EMSA-PKCS1-v1_5 encoding method.

I referred to section 9.2 of rfc 3447(Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1)
document which says the following

         EM = 0x00 || 0x01 || PS || 0x00 || T.

where T  for SHA1 is defined as

      SHA-1:   (0x)30 21 30 09 06 05 2b 0e 03 02 1a 05 00 04 14 || H.
(H is the Hash value from Step 1).

My specific question is

Is it expected that the input I pass to RSA_private_encrypt for "from" MUST contain the HASH pre-pended with the hex value defined
    or is there any function in OpenSSL which can be called to set this value.

Awaiting your valuable response....

Regards
Suram

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to