ParagonIE_Sodium_Compat::crypto_box_seal()public staticWP 1.0

Anonymous public-key encryption. Only the recipient may decrypt messages.

Algorithm: X25519-XSalsa20-Poly1305, as with crypto_box.

The sender's X25519 keypair is ephemeral.
Nonce is generated from the BLAKE2b hash of both public keys.

This provides ciphertext integrity.

{} Это метод класса: ParagonIE_Sodium_Compat{}

Хуков нет.


Строку. Sealed message that only your recipient can decrypt


$result = ParagonIE_Sodium_Compat::crypto_box_seal( $plaintext, $publicKey );
$plaintext(строка) (обязательный)
Message to be sealed
$publicKey(строка) (обязательный)
Your recipient's public key

Код ParagonIE_Sodium_Compat::crypto_box_seal() WP 6.0

public static function crypto_box_seal($plaintext, $publicKey)
    /* Type checks: */
    ParagonIE_Sodium_Core_Util::declareScalarType($plaintext, 'string', 1);
    ParagonIE_Sodium_Core_Util::declareScalarType($publicKey, 'string', 2);

    /* Input validation: */
    if (ParagonIE_Sodium_Core_Util::strlen($publicKey) !== self::CRYPTO_BOX_PUBLICKEYBYTES) {
        throw new SodiumException('Argument 2 must be CRYPTO_BOX_PUBLICKEYBYTES long.');

    if (self::useNewSodiumAPI()) {
        return (string) sodium_crypto_box_seal($plaintext, $publicKey);
    if (self::use_fallback('crypto_box_seal')) {
        return (string) call_user_func('\\Sodium\\crypto_box_seal', $plaintext, $publicKey);
    if (PHP_INT_SIZE === 4) {
        return ParagonIE_Sodium_Crypto32::box_seal($plaintext, $publicKey);
    return ParagonIE_Sodium_Crypto::box_seal($plaintext, $publicKey);