|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66122 Certification cannot be used directly after openssl_csr_sign
Submitted: 2013-11-20 04:40 UTC Modified: -
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: phpbugs at lavoie dot sl Assigned:
Status: Open Package: OpenSSL related
PHP Version: 5.5.6 OS: Linux/Mac
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 — but make sure to vote on the bug!
Your email address:
Solve the problem:
45 - 9 = ?
Subscribe to this entry?

 [2013-11-20 04:40 UTC] phpbugs at lavoie dot sl
When generating a CRT using KEY/CSR, the certificate resource is not "ready". To use it, you have to export and import it back.

The test was done using a CA or a selfsigned.

Tested on 3 systems:
  OSX 10.9
    PHP 5.5.6 (brew)
    OpenSSL 1.0.1e

    OpenSSL 1.0.1c

    PHP 5.3.10-1ubuntu3.6
    OpenSSL 1.0.1 (Native)

If nobody can reproduce this, I can post the rest of the system configurations

Test script:
$key = openssl_pkey_new();
$csr = openssl_csr_new(array(), $key);
$crt = openssl_csr_sign($csr, null, $key, 365 * 100);

openssl_pkcs7_encrypt($plain1, $enc, $crt, array('foo' => 'bar'));
openssl_pkcs7_decrypt($enc, $plain2, $crt, $key); // error, empty

Full example:

Expected result:
string(0) "hello"
string(5) "hello"
string(0) "hello"
array(0) {

Actual result:
error:21070073:PKCS7 routines:PKCS7_dataDecode:no recipient matches certificatestring(0) ""
string(5) "hello"
error:21070073:PKCS7 routines:PKCS7_dataDecode:no recipient matches certificatestring(0) ""
array(0) {


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Mar 21 18:03:39 2023 UTC