It should be

pRSA->n = BN_bin2bn( pPublicModulus, nPublicModulusLength, NULL );
pRSA->e = BN_bin2bn( pPublicExponent, nPublicExponentLength, NULL ); 


Frank Wockenfuß

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Wockenfuß, Frank
Gesendet: Mittwoch, 1. August 2007 11:08
An: openssl-users@openssl.org
Betreff: AW: RSA_public_decrypt problem

I understood, that n should be the modulus and e the exponent.

pRSA->n = BN_bin2bn( pPublicModulus, nPublicModulusLength, NULL ); e = 
pRSA->BN_bin2bn( pPublicExponent, nPublicExponentLength, NULL );

Frank Wockenfuß

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Marek Marcola
Gesendet: Mittwoch, 1. August 2007 11:02
An: openssl-users@openssl.org
Betreff: Re: RSA_public_decrypt problem

Hello,
> I'm trying to use the RSA_public_decrypt function but I need to set up the 
> public key "manually".
> I have the public exponent and modulus in the form of an array of 
> 'unsigned char' and have converted these to BIGNUM format using BN_bin2bn. I 
> assigned them to the RSA fields n and e.
> The I call RSA_public_decrypt, but it is returning -1. Calling ERR_GET_REASON 
> returns 101 (RSA_F_RSA_EAY_PRIVATE_DECRYPT?)?
> What does this mean and how do I need to change my program?
> 
> I'm using OpenSSL 0.9.8e and WinXP/Visual Studio 2005.
> The modulus and exponent values I set to the structure are read from a 
> smartcard.
Looks like swapped n and e in RSA (if correctly read to BN). 

Best regards,
--
Marek Marcola <[EMAIL PROTECTED]>

______________________________________________________________________
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]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to