1
0
mirror of https://github.com/php/php-src.git synced 2026-04-16 20:41:18 +02:00
Files
archived-php-src/ext/openssl/tests/bug61930.phpt
Jakub Zelenka 3c42f64e6e Make code in openssl ext tests more consistent
Mainly use spaces for indent and fix some other CS issues. Also
drop checks for unsupported OpenSSL library versions.
2018-06-21 16:38:19 +01:00

27 lines
665 B
PHP

--TEST--
Bug #61930: openssl corrupts ssl key resource when using openssl_get_publickey()
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
--FILE--
<?php
$cert = file_get_contents(__DIR__.'/cert.crt');
$data = <<<DATA
Please verify me
DATA;
$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptl' .
'AODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2' .
'LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
$key = openssl_get_publickey($cert);
var_dump(openssl_get_publickey($key));
var_dump(openssl_verify($data, base64_decode($sig), $key));
?>
--EXPECTF--
resource(%d) of type (OpenSSL key)
int(1)