ParagonIE_Sodium_Crypto::box_seal_open() public WP 1.0
Opens a message encrypted via box_seal().
{} Это метод класса: ParagonIE_Sodium_Crypto{}
Хуков нет.
Возвращает
Строку.
Использование
$result = ParagonIE_Sodium_Crypto::box_seal_open( $message, $keypair );
- $message(строка) (обязательный)
- -
- $keypair(строка) (обязательный)
- -
Код ParagonIE_Sodium_Crypto::box_seal_open() ParagonIE Sodium Crypto::box seal open WP 5.6.2
public static function box_seal_open($message, $keypair)
{
/** @var string $ephemeralPK */
$ephemeralPK = ParagonIE_Sodium_Core_Util::substr($message, 0, 32);
/** @var string $ciphertext (ciphertext + MAC) */
$ciphertext = ParagonIE_Sodium_Core_Util::substr($message, 32);
/** @var string $secretKey */
$secretKey = self::box_secretkey($keypair);
/** @var string $publicKey */
$publicKey = self::box_publickey($keypair);
/** @var string $nonce */
$nonce = self::generichash(
$ephemeralPK . $publicKey,
'',
24
);
/** @var string $keypair */
$keypair = self::box_keypair_from_secretkey_and_publickey($secretKey, $ephemeralPK);
/** @var string $m */
$m = self::box_open($ciphertext, $nonce, $keypair);
try {
ParagonIE_Sodium_Compat::memzero($secretKey);
ParagonIE_Sodium_Compat::memzero($ephemeralPK);
ParagonIE_Sodium_Compat::memzero($nonce);
} catch (SodiumException $ex) {
$secretKey = null;
$ephemeralPK = null;
$nonce = null;
}
return $m;
}