1--TEST-- 2openssl_sign/verify: accept different algos 3--SKIPIF-- 4<?php 5if (!extension_loaded("openssl")) die("skip"); 6?> 7--FILE-- 8<?php 9$dir = dirname(__FILE__); 10$file_pub = $dir . '/bug37820cert.pem'; 11$file_key = $dir . '/bug37820key.pem'; 12 13$priv_key = file_get_contents($file_key); 14$priv_key_id = openssl_get_privatekey($priv_key); 15 16 17$pub_key = file_get_contents($file_pub); 18$pub_key_id = openssl_get_publickey($pub_key); 19$data = "some custom data"; 20if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) { 21 echo "openssl_sign failed."; 22} 23 24$ok = openssl_verify($data, $signature, $pub_key_id, OPENSSL_ALGO_MD5); 25if ($ok == 1) { 26 echo "Ok"; 27} elseif ($ok == 0) { 28 echo "openssl_verify failed."; 29} 30 31 32?> 33--EXPECTF-- 34Ok 35