codecamp

PHP8 sodium_crypto_box_open

(PHP 7 >= 7.2.0, PHP 8)

sodium_crypto_box_open — 经过身份验证的公钥解密

说明

sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string|false

使用非对称(公钥)加密技术解密消息。

参数 

ciphertext

要尝试解密的加密消息。

nonce

每封邮件只能使用一次的号码。长度为 24 个字节。 这是一个足够大的绑定,可以随机生成(即 random_bytes())。

key_pair

请参见 sodium_crypto_box_keypair_from_secretkey_and_publickey()。 这应该包括发件人的公钥和收件人的私钥。

返回值 

Returns the plaintext message on success, 或者在失败时返回 false.


PHP8 sodium_crypto_box_keypair
PHP8 sodium_crypto_box_publickey_from_secretkey
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定