xref: /PHP-5.3/ext/openssl/tests/bug41033.phpt (revision d543e3d9)
1--TEST--
2#41033, enable signing with DSA keys
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) die("skip, openssl required");
6if (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!";
16openssl_sign($ct, $signature, $prkeyid, OPENSSL_ALGO_DSS1);
17echo "Signature: ".base64_encode($signature) . "\n";
18
19$pukeyid = openssl_get_publickey($pub);
20$valid = openssl_verify($ct, $signature, $pukeyid, OPENSSL_ALGO_DSS1);
21echo "Signature validity: " . $valid . "\n";
22
23
24?>
25--EXPECTF--
26Signature: %s
27Signature validity: 1
28