| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
Note: to use openssl_sign with ed25519 key in PHP 8.4 (and probably later versions), you need to explicitly pass 0 as algorithm identifier. Omitting this parameter will not work (because this parameter defaults to SHA1), but for some reason there is currently no OPENSSL_ALGO_xxxxx constant for the default signature algorithm.
<?php
$pkey = openssl_pkey_new(['private_key_type' => OPENSSL_KEYTYPE_ED25519]);
if (openssl_sign('text', $sig, $pkey, 0)) {
echo 'Signature successful: ' . bin2hex($sig);
} else {
echo 'Signature failed!';
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2a03:5800:f0c5:c580:7486:5209:2ec7:5a50)
----
Manual Page -- https://php.net/manual/en/function.openssl-sign.php
Edit -- https://main.php.net/note/edit/130469
Del: integrated -- https://main.php.net/note/delete/130469/integrated
Del: useless -- https://main.php.net/note/delete/130469/useless
Del: bad code -- https://main.php.net/note/delete/130469/bad+code
Del: spam -- https://main.php.net/note/delete/130469/spam
Del: non-english -- https://main.php.net/note/delete/130469/non-english
Del: in docs -- https://main.php.net/note/delete/130469/in+docs
Del: other reasons-- https://main.php.net/note/delete/130469
Reject -- https://main.php.net/note/reject/130469
Search -- https://main.php.net/manage/user-notes.php