Download src/php/php-src/ext/openssl/tests/bug37820.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 686 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/openssl/tests/bug37820.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/openssl/tests/bug37820.phpt
-
curl -L -o bug37820.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/openssl/tests/bug37820.phpt
686 Bytes
| --TEST-- | |
| openssl_sign/verify: accept different algos | |
| --EXTENSIONS-- | |
| openssl | |
| --FILE-- | |
| $dir = __DIR__; | |
| $file_pub = $dir . '/bug37820cert.pem'; | |
| $file_key = $dir . '/bug37820key.pem'; | |
| $priv_key = file_get_contents($file_key); | |
| $priv_key_id = openssl_get_privatekey($priv_key); | |
| $pub_key = file_get_contents($file_pub); | |
| $pub_key_id = openssl_get_publickey($pub_key); | |
| $data = "some custom data"; | |
| if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) { | |
| echo "openssl_sign failed."; | |
| } | |
| $ok = openssl_verify($data, $signature, $pub_key_id, OPENSSL_ALGO_MD5); | |
| if ($ok == 1) { | |
| echo "Ok"; | |
| } elseif ($ok == 0) { | |
| echo "openssl_verify failed."; | |
| } | |
| --EXPECT-- | |
| Ok | |