Yes, I'm trying to verify a RSA signature. 
What can I do to verify it correctly?


Frank Wockenfuß

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von David Schwartz
Gesendet: Mittwoch, 1. August 2007 11:01
An: openssl-users@openssl.org
Betreff: RE: RSA_public_decrypt problem


> You're right, I get RSA_R_BAD_E_VALUE (101). Just took the wrong 
> define for the mail. ERR_GET_REASON returns 101.

Only the RSA key generation function can produce this error. Perhaps you had it 
left over from a previous function you called? Perhaps your engine can generate 
this error in response to other commands?

> I want to use RSA_public_decrypt to get back the hashvalue that was 
> encrypted with RSA inside the smartcardterminal. And I don't get the 
> private key of the card so I have to use the public key.
> This is only for verification purpose.

You may be misunderstanding the purpose of this function. It's not clear.

Normally, we encrypt with the public key and decrypt with the private key.
When you encrypt with the private key such that anyone with the public key can 
decrypt it, that's called a signature. In this 'encryption' is really signing 
and 'decrypting' is signature verification.

You cannot decrypt something with the public key unless it's a signature.

It is easy to confuse two meanings of the word "encrypt". One is the 
mathematical operation in the RSA cipher that doesn't necessarily provide any 
actual encryption (in the sense of security from interception) at all.
The RSA_public_decrypt function performs the RSA cipher function of decryption 
using the public key. This is normally used to verify a signature. It cannot be 
used to actually decrypt anything since real decryption requires the private 
key -- that's its entire point.

Again, RSA_public_decrypt and RSA_private_encrypt are signature generation and 
validation functions. They have nothing to do with encrypting or decrypting 
information to prevent interception by nefarious third parties.
(Why 'encrypt'4 something so that anyone with the public key can decrypt it?
Simple -- that makes perfect sense if you're signing it.)

So what you are attempting may be fundamentally broken. Are you trying to 
verify an RSA signature?

DS


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

Reply via email to