php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #77602 OpenSSL extension lacks PKCS#8 support
Submitted: 2019-02-11 10:22 UTC Modified: -
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: jonas at freesources dot org Assigned:
Status: Open Package: OpenSSL related
PHP Version: 7.3.2 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-02-11 10:22 UTC] jonas at freesources dot org
Description:
------------
Hello,

the PHP openssl extension lacks support to export private keys in PKCS#8[1] format. The function openssl_pkey_export()[2] only supports one export format - the traditional PEM format. This is especially a problem when maintaining keys for applications that accept only the PKCS#8 format as input (like the Dovecot MailCrypt plugin[3])

The only PHP libraries I found with PKCS#8 support are phpseclib[4] and SOP\pkcs8[5]. Unfortunately, both lack support for elliptic curve keys, so they're not an option for me either.

The only option left to me, was to spawn a system call to `openssl pkey` just for the sake of migrating the traditional PEM key to PKCS#8 format.

[1] https://en.wikipedia.org/wiki/PKCS_8
[2] https://secure.php.net/manual/en/function.openssl-pkey-export.php
[3] https://wiki.dovecot.org/Plugins/MailCrypt#EC_key
[4] https://github.com/phpseclib/phpseclib
[5] https://github.com/sop/pkcs8


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 15 18:01:25 2019 UTC