"montinip@libero." wrote:
> 
> Hi everybody,
> I have a problem: I am developing a project in which I need to use
> 'special' RSA private keys.
> I use RSA_generate_key() to generate the key pair and the I use BN_copy
> to modify manually tha value of rsa->d.
> If I check with RSA_check_key the test fails as it was supposed to do
> and also I am sure that the value has been changed when I use RSA_print!
> But when I use RSA_private_encrypt to sign a digest it uses the 'old'
> rsa->d value, the one generated with RSA_generate_key !!!
> 
> Someone can tell me why? How does RSA_private_encrypt work?Why it
> doesn't simply do to = from^rsa->d mod rsa->n ?
> 

It doesn't do that because it uses the Chinese remainder theorem 
version of the RSA algorithm which is faster. 

The reason you are seeing that behaviour is that the CRT version 
doesn't use 'd' if all the other CRT components are present. Try
BN_free()ing and NULLing one or more of the components like rsa->p
or rsa->q first.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to