Annotation of embedaddon/php/ext/openssl/tests/bug41033.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: #41033, enable signing with DSA keys
                      3: --SKIPIF--
                      4: <?php 
                      5: if (!extension_loaded("openssl")) die("skip, openssl required");
                      6: if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: $prv = 'file://' . dirname(__FILE__) . '/' . 'bug41033.pem';
                     11: $pub = 'file://' . dirname(__FILE__) . '/' . 'bug41033pub.pem';
                     12: 
                     13: 
                     14: $prkeyid = openssl_get_privatekey($prv, "1234");
                     15: $ct = "Hello I am some text!";
                     16: openssl_sign($ct, $signature, $prkeyid, OPENSSL_ALGO_DSS1);
                     17: echo "Signature: ".base64_encode($signature) . "\n";
                     18: 
                     19: $pukeyid = openssl_get_publickey($pub);
                     20: $valid = openssl_verify($ct, $signature, $pukeyid, OPENSSL_ALGO_DSS1);
                     21: echo "Signature validity: " . $valid . "\n";
                     22: 
                     23: 
                     24: ?>
                     25: --EXPECTF--
                     26: Signature: %s
                     27: Signature validity: 1

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>