diff options
author | Pierre Joye <pajoye@php.net> | 2008-11-18 01:56:12 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2008-11-18 01:56:12 +0000 |
commit | d543e3d987b543501e27b497d55dffc4c89b24d5 (patch) | |
tree | 5042ea9de84a66981a2523b1196474bd6110c74d /ext/openssl/tests/bug41033.phpt | |
parent | 34742e3f134e7b53e8b763c72640c0b092ad2ad9 (diff) | |
download | php-git-d543e3d987b543501e27b497d55dffc4c89b24d5.tar.gz |
- #41033, enable signing with DSA keys
Diffstat (limited to 'ext/openssl/tests/bug41033.phpt')
-rw-r--r-- | ext/openssl/tests/bug41033.phpt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/openssl/tests/bug41033.phpt b/ext/openssl/tests/bug41033.phpt new file mode 100644 index 0000000000..4aeae66f41 --- /dev/null +++ b/ext/openssl/tests/bug41033.phpt @@ -0,0 +1,27 @@ +--TEST-- +#41033, enable signing with DSA keys +--SKIPIF-- +<?php +if (!extension_loaded("openssl")) die("skip, openssl required"); +if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip"); +?> +--FILE-- +<?php +$prv = 'file://' . dirname(__FILE__) . '/' . 'bug41033.pem'; +$pub = 'file://' . dirname(__FILE__) . '/' . 'bug41033pub.pem'; + + +$prkeyid = openssl_get_privatekey($prv, "1234"); +$ct = "Hello I am some text!"; +openssl_sign($ct, $signature, $prkeyid, OPENSSL_ALGO_DSS1); +echo "Signature: ".base64_encode($signature) . "\n"; + +$pukeyid = openssl_get_publickey($pub); +$valid = openssl_verify($ct, $signature, $pukeyid, OPENSSL_ALGO_DSS1); +echo "Signature validity: " . $valid . "\n"; + + +?> +--EXPECTF-- +Signature: %s +Signature validity: 1 |