函数名:rnp_op_verify_detached()
适用版本:PHP 7.4.0及以上版本
函数说明:rnp_op_verify_detached()函数用于验证一个已分离的签名,返回签名是否有效。
用法:
bool rnp_op_verify_detached(string $input, string $signature, string $public_key)
参数:
返回值:
示例:
$input = 'Hello, world!'; // 需要验证的数据
$signature = file_get_contents('signature.bin'); // 读取签名文件
$public_key = file_get_contents('public_key.asc'); // 读取公钥文件
$isValid = rnp_op_verify_detached($input, $signature, $public_key);
if ($isValid) {
echo '签名有效';
} else {
echo '签名无效';
}
注意事项: