Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why OpenSSL RSA_sign function needs int type parameter?

RSA signature generation is supposed to be modular exponentiation on big numbers; I understand why OpenSSL needs message digest and its size to calculate RSA signature, however, why it is required to know what is message digest algorithm used to generate input value to calculate its modular exponentiation and generate signature?

like image 607
Vitalii Avatar asked Sep 21 '26 17:09

Vitalii


1 Answers

The signature is calculated from the hash and the hash algorithm formatted as a PKCS#1 v1.5 DigestInfo (See RFC2313, section 10.1.2). This is required, to ensure that the recipient can recalculate the hash themselves to verify the signature, and it must be included in the signature to ensure that the indicated hash algorithm hasn't been changed by an attacker.

like image 61
Iridium Avatar answered Sep 24 '26 08:09

Iridium



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!