diff options
Diffstat (limited to 'ext/openssl/tests')
| -rw-r--r-- | ext/openssl/tests/001.phpt | 5 | ||||
| -rw-r--r-- | ext/openssl/tests/bug41033.phpt | 6 | ||||
| -rw-r--r-- | ext/openssl/tests/bug66501.phpt | 3 | ||||
| -rw-r--r-- | ext/openssl/tests/openssl_error_string_basic.phpt | 6 | ||||
| -rw-r--r-- | ext/openssl/tests/openssl_free_key.phpt | 5 |
5 files changed, 14 insertions, 11 deletions
diff --git a/ext/openssl/tests/001.phpt b/ext/openssl/tests/001.phpt index 4ca9970bca..627077e8f4 100644 --- a/ext/openssl/tests/001.phpt +++ b/ext/openssl/tests/001.phpt @@ -18,7 +18,8 @@ for ($z = "", $i = 0; $i < 1024; $i++) { usleep($i); } -$privkey = openssl_pkey_new(); +$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf'); +$privkey = openssl_pkey_new($conf); if ($privkey === false) die("failed to create private key"); @@ -30,7 +31,7 @@ if ($key_file_name === false) echo "Export key to file\n"; -openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name"); +openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name"); echo "Load key from file - array syntax\n"; diff --git a/ext/openssl/tests/bug41033.phpt b/ext/openssl/tests/bug41033.phpt index 4aeae66f41..c665be5273 100644 --- a/ext/openssl/tests/bug41033.phpt +++ b/ext/openssl/tests/bug41033.phpt @@ -10,14 +10,14 @@ if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip"); $prv = 'file://' . dirname(__FILE__) . '/' . 'bug41033.pem'; $pub = 'file://' . dirname(__FILE__) . '/' . 'bug41033pub.pem'; - +$alg = (OPENSSL_VERSION_NUMBER < 0x10000000) ? OPENSSL_ALGO_DSS1 : OPENSSL_ALGO_SHA1; $prkeyid = openssl_get_privatekey($prv, "1234"); $ct = "Hello I am some text!"; -openssl_sign($ct, $signature, $prkeyid, OPENSSL_ALGO_DSS1); +openssl_sign($ct, $signature, $prkeyid, $alg); echo "Signature: ".base64_encode($signature) . "\n"; $pukeyid = openssl_get_publickey($pub); -$valid = openssl_verify($ct, $signature, $pukeyid, OPENSSL_ALGO_DSS1); +$valid = openssl_verify($ct, $signature, $pukeyid, $alg); echo "Signature validity: " . $valid . "\n"; diff --git a/ext/openssl/tests/bug66501.phpt b/ext/openssl/tests/bug66501.phpt index 7ad5e21749..a9d1359cd8 100644 --- a/ext/openssl/tests/bug66501.phpt +++ b/ext/openssl/tests/bug66501.phpt @@ -16,7 +16,8 @@ AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
-----END EC PRIVATE KEY-----';
$key = openssl_pkey_get_private($pkey);
-$res = openssl_sign($data ='alpha', $sign, $key, 'ecdsa-with-SHA1');
+$sigalg = (OPENSSL_VERSION_NUMBER < 0x10000000) ? 'ecdsa-with-SHA1' : 'SHA1';
+$res = openssl_sign($data ='alpha', $sign, $key, $sigalg);
var_dump($res);
--EXPECTF--
bool(true)
diff --git a/ext/openssl/tests/openssl_error_string_basic.phpt b/ext/openssl/tests/openssl_error_string_basic.phpt index 82f3099264..04cc5508a4 100644 --- a/ext/openssl/tests/openssl_error_string_basic.phpt +++ b/ext/openssl/tests/openssl_error_string_basic.phpt @@ -89,7 +89,7 @@ expect_openssl_errors('openssl_pkey_export_to_file opening', ['02001002', '2006D expect_openssl_errors('openssl_pkey_export_to_file pem', ['0906D06C']); // file to export cannot be written @openssl_pkey_export_to_file($private_key_file, $invalid_file_for_write); -expect_openssl_errors('openssl_pkey_export_to_file write', ['2006D002', '09072007']); +expect_openssl_errors('openssl_pkey_export_to_file write', ['2006D002']); // succesful export @openssl_pkey_export($private_key_file_with_pass, $out, 'wrong pwd'); expect_openssl_errors('openssl_pkey_export', ['06065064', '0906A065']); @@ -105,7 +105,7 @@ expect_openssl_errors('openssl_private_decrypt', ['04065072']); // public encrypt and decrypt with failed padding check and padding @openssl_public_encrypt("data", $crypted, $public_key_file, 1000); @openssl_public_decrypt("data", $crypted, $public_key_file); -expect_openssl_errors('openssl_private_(en|de)crypt padding', ['0906D06C', '04068076', '0407006A', '04067072']); +expect_openssl_errors('openssl_private_(en|de)crypt padding', ['0906D06C', '04068076', '04067072']); // X509 echo "X509 errors\n"; @@ -126,7 +126,7 @@ expect_openssl_errors('openssl_x509_checkpurpose purpose', ['0B086079']); echo "CSR errors\n"; // file for csr (file:///) fails when opennig (BIO_new_file) @openssl_csr_get_subject("file://" . $invalid_file_for_read); -expect_openssl_errors('openssl_csr_get_subject open', ['02001002', '2006D080', '20068079', '0906D06C']); +expect_openssl_errors('openssl_csr_get_subject open', ['02001002', '2006D080']); // file or str csr is not correct PEM - failing PEM_read_bio_X509_REQ @openssl_csr_get_subject($crt_file); expect_openssl_errors('openssl_csr_get_subjec pem', ['0906D06C']); diff --git a/ext/openssl/tests/openssl_free_key.phpt b/ext/openssl/tests/openssl_free_key.phpt index 816f7cf5eb..ea79ce703a 100644 --- a/ext/openssl/tests/openssl_free_key.phpt +++ b/ext/openssl/tests/openssl_free_key.phpt @@ -22,7 +22,8 @@ for ($z = "", $i = 0; $i < 1024; $i++) { usleep($i); } -$privkey = openssl_pkey_new(); +$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf'); +$privkey = openssl_pkey_new($conf); if ($privkey === false) die("failed to create private key"); @@ -34,7 +35,7 @@ if ($key_file_name === false) echo "Export key to file\n"; -openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name"); +openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name"); echo "Load key from file - array syntax\n"; |
