Hello,
I have a little problem with the function 'RSA_public_encrypt(..)'.
>From the documentation:
int RSA_public_encrypt(int flen, unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
flen must be less than RSA_size(rsa) - 11 for the PKCS #1
v1.5 based padding modes, and less than RSA_size(rsa) - 21
for RSA_PKCS1_OAEP_PADDING. The random number generator
must be seeded prior to calling RSA_public_encrypt().
For a key of size 1024 (RSA_size(public_key) == 128) the followin occures:
RSA_public_encrypt(117, text, crypt_buffer, public_key, RSA_PKCS1_PADDING)
succceeds.
RSA_public_encrypt(118, text, crypt_buffer, public_key, RSA_PKCS1_PADDING)
failes with
78120:error:0406D06E:rsa routines:RSA_padding_add_PKCS1_type_2:data too large for key
size:rsa_pk1.c:151:
This is o.k. according to the docu, but:
RSA_public_encrypt(107, text, crypt_buffer, public_key, RSA_PKCS1_OAEP_PADDING)
failes with
78195:error:0407906E:rsa routines:RSA_padding_add_PKCS1_OAEP:data too large for key
size:rsa_oaep.c:27:
and the first flen which succeeds is 86:
RSA_public_encrypt(86, text, crypt_buffer, public_key, RSA_PKCS1_OAEP_PADDING)
succeeds.
RSA_public_encrypt(87, text, crypt_buffer, public_key, RSA_PKCS1_OAEP_PADDING)
fails with
78237:error:0407906E:rsa routines:RSA_padding_add_PKCS1_OAEP:data too large for key
size:rsa_oaep.c:27:
This would mean that for RSA_PKCS1_OAEP_PADDING flen must be less than
RSA_size(rsa) - 41 !!
Is this a bug in the documentation or a bug in the RSA functions?
I used OpenSSL version 0.9.5a on FreeBSD 3.4.
Peter
---
Peter Seiderer E-Mail: [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]