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