3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Keys taken from the phpecc unit tests, but that library's still vulnerable * to several side-channels, so don't use it. */ $private = '-----BEGIN EC PRIVATE KEY----- MHQCAQEEIOZ0ioEAxAkAH/7gnZZWIvReXfez9ahXMpOwHzdEkvKcoAcGBSuBBAAK oUQDQgAE8bjuAc1ucXAA/LbG9i2DSSD8pdgsze34XPD+ddINq3IR/F7TbNvHJdYL alPIMqm0GJuVB+UGg5duB+921yHYPQ== -----END EC PRIVATE KEY-----'; $public = '-----BEGIN PUBLIC KEY----- MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE8bjuAc1ucXAA/LbG9i2DSSD8pdgsze34 XPD+ddINq3IR/F7TbNvHJdYLalPIMqm0GJuVB+UGg5duB+921yHYPQ== -----END PUBLIC KEY-----'; $privateKey = openssl_pkey_get_private($private); $publicKey = openssl_pkey_get_public($public); $data = /* file_get_contents("download.zip")*/ 'Foo bar'; $res = openssl_sign($data, $signature, $privateKey, OPENSSL_ALGO_SHA256); var_dump(base64_encode($signature)); $ok = openssl_verify($data, $signature, $publicKey, OPENSSL_ALGO_SHA256); var_dump($ok);
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.27, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1
Fatal error: Uncaught Error: Call to undefined function openssl_pkey_get_private() in /in/E1C9Y:18 Stack trace: #0 {main} thrown in /in/E1C9Y on line 18
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Call to undefined function openssl_pkey_get_private() in /in/E1C9Y on line 18
Process exited with code 255.

preferences:
77.63 ms | 407 KiB | 5 Q