On Wed, Apr 21, 2004 at 09:38:49PM +0400, Alexander Krizhanovskiy wrote:
> Hello!
> 
> I'am using RSA_public_encrypt() and RSA_private_decrypt(). I can't encrypt 
> data with zero byte (for example hash data). My code like this:
> 
> 
> unsigned char *buf = "null\x0null";
> .....
> RSA_public_encrypt ( 9, buf, outbuf, rsa, RSA_PKCS1_PADDING);
> ......
> RSA_private_decrypt ( RSA_size(rsa), outbuf, mess, rsa, RSA_PKCS1_PADDING);
> 
> 
> After that mess will be "null". Is it passible to encrypt data with zero 
> bytes? If so, then how?

Please forgive me if I'm asking silly questions.

1.  Have you checked the return value of RSA_private_decrypt?  It is
    supposed to be the number of bytes of plaintext.  (This is logical.
    How else would you know how many bytes are in the plaintext?)

2.  How do you know that the "mess" is truncated?  Of course, you're not
    just "printf"ing the string.  And, of course, you're not just
    examining the string in a debugger.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to