"Jason A. Aras" wrote:
> 
> I am working on a quick C hack to test out the use of the RSA encryption
> functions.  When i make a call to RSA_public_encrypt() it sometimes
> fails (but does not return a -1) and sometimes works.
> 

What makes you think it fails?

> When it fails it returns the length of a string, but a strlen() on the
> 'to' variable is not equal to what RSA_public_encrypt() returns.  I do
> not know what the problem is, other than a memory problem.  I first
> thought the problem was in calling RSA_private_decrypt(); because it was
> returning a packing error, but it turned out that the crypted data was
> corrupt some how.
> 

strlen() wont work on encrypted data since it can contain embedded
nulls. In the case of RSA_public_encrypt() the size of the encrypted
data is always RSA_size(key) as indicated in the manual.

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
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to