ParagonIE_Sodium_Compat::crypto_secretbox_xchacha20poly1305_open() public WP 1.0
Decrypts a message previously encrypted with crypto_secretbox_xchacha20poly1305().
{} Это метод класса: ParagonIE_Sodium_Compat{}
Хуков нет.
Возвращает
Строку
. Original plaintext message
Использование
$result = ParagonIE_Sodium_Compat::crypto_secretbox_xchacha20poly1305_open( $ciphertext, $nonce, $key );
- $ciphertext(строка) (обязательный)
- Ciphertext with Poly1305 MAC
- $nonce(строка) (обязательный)
- A Number to be used Once; must be 24 bytes
- $key(строка) (обязательный)
- Symmetric encryption key
Код ParagonIE_Sodium_Compat::crypto_secretbox_xchacha20poly1305_open() ParagonIE Sodium Compat::crypto secretbox xchacha20poly1305 open WP 5.7.1
public static function crypto_secretbox_xchacha20poly1305_open($ciphertext, $nonce, $key)
{
/* Type checks: */
ParagonIE_Sodium_Core_Util::declareScalarType($ciphertext, 'string', 1);
ParagonIE_Sodium_Core_Util::declareScalarType($nonce, 'string', 2);
ParagonIE_Sodium_Core_Util::declareScalarType($key, 'string', 3);
/* Input validation: */
if (ParagonIE_Sodium_Core_Util::strlen($nonce) !== self::CRYPTO_SECRETBOX_NONCEBYTES) {
throw new SodiumException('Argument 2 must be CRYPTO_SECRETBOX_NONCEBYTES long.');
}
if (ParagonIE_Sodium_Core_Util::strlen($key) !== self::CRYPTO_SECRETBOX_KEYBYTES) {
throw new SodiumException('Argument 3 must be CRYPTO_SECRETBOX_KEYBYTES long.');
}
if (PHP_INT_SIZE === 4) {
return ParagonIE_Sodium_Crypto32::secretbox_xchacha20poly1305_open($ciphertext, $nonce, $key);
}
return ParagonIE_Sodium_Crypto::secretbox_xchacha20poly1305_open($ciphertext, $nonce, $key);
}