diff options
Diffstat (limited to 'ext/openssl/tests/bug73833.phpt')
-rw-r--r-- | ext/openssl/tests/bug73833.phpt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/openssl/tests/bug73833.phpt b/ext/openssl/tests/bug73833.phpt new file mode 100644 index 0000000000..e6a298fdcc --- /dev/null +++ b/ext/openssl/tests/bug73833.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #73833: null character not allowed in openssl_pkey_get_private +--SKIPIF-- +<?php +if (!extension_loaded("openssl")) die("skip openssl not loaded"); +?> +--FILE-- +<?php +$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"; + } + if (openssl_pkey_get_private($privatePEM, $password) === false) { + echo "Failed to decrypt.\n"; + } else { + echo "Decrypted!\n"; + } +} +?> +--EXPECT-- +Encrypted! +Decrypted! +Encrypted! +Decrypted! |