On Mon, Sep 19, 2005, Chris Rutherford wrote:

> Hi All,
> 
> I have a strange problem with RSA_Public_Encrypt.  Basically it only
> produces decipherable information about 50% of the time, but with the
> same clear text string.  i.e. I have an RSA encrypt decrypt benchmark
> program using a static clear text char string.  sometimes it works,
> but other times it produces a padding error when I decrypt, but using
> the same clear text.  Is this some kind of seeding problem?  How else
> could it work about 50% of the time with the same clear text?
> 

I did answer this before but it doesn't seem to have made it to the list. Are
you assuming the result is a text string and using/copying it with something
like strlen()? If so that will fail if the result contains an embedded null.

RSA_public_encrypt() with PKCS#1 padding contains a random element so you will
get different results for the same plaintext.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to