php.net |  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
Votes:4
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
 [2003-12-19 04:36 UTC] fch at hexanet dot fr
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-01 20:48 UTC] sniper@php.net
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] wez@php.net
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-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 10:03:34 2021 UTC