1--TEST-- 2Bug #73833: null character not allowed in openssl_pkey_get_private 3--EXTENSIONS-- 4openssl 5--FILE-- 6<?php 7$passwords = ["abc\x00defghijkl", "abcdefghikjl"]; 8$conf = ['config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf']; 9 10foreach($passwords as $password) { 11 $key = openssl_pkey_new($conf); 12 13 if (openssl_pkey_export($key, $privatePEM, $password, $conf) === false) { 14 echo "Failed to encrypt.\n"; 15 } else { 16 echo "Encrypted!\n"; 17 } 18 if (openssl_pkey_get_private($privatePEM, $password) === false) { 19 echo "Failed to decrypt.\n"; 20 } else { 21 echo "Decrypted!\n"; 22 } 23} 24?> 25--EXPECT-- 26Encrypted! 27Decrypted! 28Encrypted! 29Decrypted! 30