|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-12-29 15:34 UTC] mfaust at usinternet dot com
[2017-04-24 16:01 UTC] bukka@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: bukka
[2017-04-24 16:11 UTC] bukka@php.net
[2017-04-24 16:11 UTC] bukka@php.net
-Status: Assigned
+Status: Closed
[2017-04-24 16:13 UTC] bukka@php.net
[2017-04-24 16:14 UTC] bukka@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 05:00:01 2025 UTC |
Description: ------------ When encrypting a private key for export you are allowed to have a null character as part of the password key, but when decrypting with openssl_pkey_get_private it fails to decrypt with the same key. PHP is compiled against OpenSSL 1.0.1e-fips 11 Feb 2013 Test script: --------------- //This will fail to decrypt using the first password due to the null byte (\x00) $passwords = ["abc\x00defghijkl", "abcdefghikjl"]; foreach($passwords as $password){ $key = openssl_pkey_new(); if(openssl_pkey_export($key, $privatePEM, $password) === FALSE){ echo "Failed to encrypt.\n"; }else{ echo "Encrypted!\n"; } //This will throw a warning and fail to decrypt. if(openssl_pkey_get_private($privatePEM, $password) === FALSE){ echo "Failed to decrypt.\n"; }else{ echo "Decrypted!\n"; }