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