sodium_crypto_sign_verify_detached
(PHP 7 >= 7.2.0, PHP 8)
sodium_crypto_sign_verify_detached — Verify signature for the message
说明
Verify signature for the message
参数
signature
-
The cryptographic signature obtained from sodium_crypto_sign_detached()
message
-
The message being verified
public_key
-
Ed25519 public key
+添加备注
用户贡献的备注 1 note
Anonymous ¶
4 years ago
<?php
$message = 'The quick brown fox jumped over the lazy dog.';
# Generate keypair
$keyPair = sodium_crypto_sign_keypair();
# Sign a message
$secKey = sodium_crypto_sign_secretkey($keyPair);
$signature = sodium_crypto_sign_detached($message, $secKey);
# Verify a message
$pubKey = sodium_crypto_sign_publickey($keyPair);
$verifyResult = sodium_crypto_sign_verify_detached($signature, $message, $pubKey);
var_dump($verifyResult); # true or false
?>
备份地址:http://www.lvesu.com/blog/php/function.sodium-crypto-sign-verify-detached.php