xref: /PHP-5.6/ext/openssl/tests/bug61930.phpt (revision 7b0107cc)
1--TEST--
2Bug #61930: openssl corrupts ssl key resource when using openssl_get_publickey()
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) die("skip");
6?>
7--FILE--
8<?php
9$cert = file_get_contents(__DIR__.'/cert.crt');
10
11$data = <<<DATA
12Please verify me
13DATA;
14
15$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptlAODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
16
17$key = openssl_get_publickey($cert);
18var_dump(openssl_get_publickey($key));
19var_dump(openssl_verify($data, base64_decode($sig), $key));
20?>
21--EXPECTF--
22resource(%d) of type (OpenSSL key)
23int(1)
24
25