php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75219 openssl_pkey_new does not work with libressl
Submitted: 2017-09-18 07:03 UTC Modified: 2017-09-29 03:12 UTC
From: chingis at wodby dot com Assigned:
Status: Closed Package: OpenSSL related
PHP Version: 7.1.9 OS: Alpine 3.6
Private report: No CVE-ID: None
 [2017-09-18 07:03 UTC] chingis at wodby dot com
Description:
------------
Function openssl_pkey_new does not work with libressl (2.5.5) on Alpine Linux (3.6)

Test script:
---------------
    $rsa_key = openssl_pkey_new([
        'private_key_bits' => 1024,
        'private_key_type' => OPENSSL_KEYTYPE_RSA
    ]);

    if (!$rsa_key) {
        throw new RuntimeException(openssl_error_string());
    }

    echo 'OK', PHP_EOL;



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-29 00:20 UTC] peterkokot at gmail dot com
As it seems the issue is that some openssl_* functions require to have a file openssl.cnf.

Possible quick fixes:

1.) apk add --no-cache libressl
or
2.) mkdir -p /etc/ssl/ && touch /etc/ssl/openssl.cnf

There should be added either a patch in the php-src if the openssl.cnf file is not present or a patch in the Alpine repositories (additional dependency for the php7-openssl package - libressl)
 [2017-09-29 03:11 UTC] chingis at wodby dot com
Yes, you're right, I expected libressl/openssl to be installed in the official php image. Reported https://github.com/docker-library/php/issues/494. Thank you.
 [2017-09-29 03:12 UTC] chingis at wodby dot com
-Status: Open +Status: Closed
 [2017-09-29 03:12 UTC] chingis at wodby dot com
Closing it.
 [2017-09-29 12:31 UTC] peterkokot at gmail dot com
Good. to know. I've added pull request also to main Alpine PHP repository here:
https://github.com/alpinelinux/aports/pull/2410
so this gets solved also in the Alpine packages.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jan 26 22:01:26 2021 UTC