|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26664 open_ssl_encrypt refuse to encrypt data larger than private key size
Submitted: 2003-12-19 04:36 UTC Modified: 2004-11-11 08:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: fch at hexanet dot fr Assigned:
Status: Not a bug Package: OpenSSL related
PHP Version: 4.3.3 OS: windows 98 and FreeBSD 4.9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
25 - 4 = ?
Subscribe to this entry?

 [2003-12-19 04:36 UTC] fch at hexanet dot fr
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:
$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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-01 20:48 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2004-11-11 06:53 UTC] pigo at pchome dot com dot tw
The same problem too.
RedHat 8.0 , OpenSSL 0.9.6b , PHP 4.3.9 !
 [2004-11-11 08:22 UTC]
That's the way that RSA works; you need to create a bigger key to be able to encrypt bigger chunks of data; the error message is quite clear.
Not a PHP bug.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 28 09:03:34 2022 UTC