[EMAIL PROTECTED] wrote:
> 
> Hi,
> 
> I have a simple application which encrypts a piece of text using RSA.
> 
> when I call RSA_public_encrypt, it should return a char * of 256 chars,
> right ? The returned char is not 256 chars long.
> 

Wrong its unsigned char * and the actual size depends on the size of the
public key. If your public key is 2048 bits you'll get 256 bytes.

> I measure with pointer hopping like this
> 
> while (*sp++)
> ;
> This way it should hop to the end of the unsigned char * and it returns the
> pointer value. (I know this works, its tested)
> 

That wont work. The encrypted data can contain embedded zeros. 

You need to check the return value of RSA_public_encrypt() to get the
actual length.

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