|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32772 error under openssl_private_encrypt and openssl_public_decrypt
Submitted: 2005-04-19 17:38 UTC Modified: 2005-04-20 19:49 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: ivan at mishanin dot ru Assigned:
Status: Not a bug Package: OpenSSL related
PHP Version: 5.0.4 OS: Windows XP, Windows 2000 Server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ivan at mishanin dot ru
New email:
PHP Version: OS:


 [2005-04-19 17:38 UTC] ivan at mishanin dot ru
When i try to encrypt big string it return null. If i try to use big key to encrypt - it help my, but if i use a big sting (300 000 signs) - it isn't work. 
i try encrypt big string by part, it's ok, but then i try to decrypt it - openssl_public_decrypt make a null decrypt text...

certificate is OK - under MS BizTolk server it's work right.

Reproduce code:
prkeyid = openssl_pkey_get_private("file://c:/cert/CAkey.pem", '1234');
$pubkeyid = openssl_pkey_get_public("file://c:/cert/CAcert.pem");

$fp = fopen ("c:/file.xml", "w+");
// for test
fwrite ($fp, $crypttext);
fclose ($fp);

openssl_public_decrypt($crypttext, $ext_data, $pubkeyid);
$fp = fopen ("c:/file2.xml", "w+");
fwrite ($fp, $ext_data);
fclose ($fp);

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-19 23:59 UTC]
Try using openssl_error_string(); after those functions and you'll get more detailed information WHY they fail.

 [2005-04-20 19:49 UTC] ivan at mishanin dot ru
after openssl_private_encrypt($res,$crypttext,$prkeyid);
openssl_error_string(); return null.
but sometimes it openssl_error_string(); return error:0406C06E:rsa routines:RSA_padding_add_PKCS1_type_1:data too large for key size
i use just one key and use just one text, i don't understand why it sometime return error:0406C06E:rsa routines:RSA_padding_add_PKCS1_type_1:data too large for key size and sometime return null, null is return more often.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Sep 29 19:05:54 2022 UTC