From: fch at hexanet dot fr
Operating system: windows 98 and FreeBSD 4.9
PHP version: 4.3.3
PHP Bug Type: OpenSSL related
Bug description: open_ssl_encrypt refuse to encrypt data larger than private key size
Description:
------------
openssl_encrypt function refuse to encrypt data larger than key size.
Then I try, open_ssl_encrypt say :
> error:0406C06E:rsa routines:RSA_padding_add_PKCS1_type_1:data too large
for key size
Openssl support is enabled and I am using OpenSSL 0.9.7c 30 Sep 2003.
Reproduce code:
---------------
#GET PRIVATE KEY PREVIOUSLY GENERATED
$private_key =
openssl_get_privatekey('file:///var/tmp/pkey.pem','r0bert');
$data =
"abcdefghijiklmnopqrstuvwxyzabcdefghijiklmnopqrstuvwxyzabcdefghijiklmnopqrstuvwxyzabcdefghijiklmnopqrstuvwxyzabcdefghijiklmnopqrstuv";
openssl_private_encrypt($data, $crypted_text, $private_key);
Expected result:
----------------
I expect crypted data in $crypted_text.
Actual result:
--------------
error:0406C06E:rsa routines:RSA_padding_add_PKCS1_type_1:data too large
for key size
--
Edit bug report at http://bugs.php.net/?id=26664&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26664&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26664&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26664&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26664&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26664&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26664&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26664&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26664&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26664&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26664&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26664&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26664&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26664&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26664&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26664&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26664&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26664&r=float