ParagonIE_Sodium_File::box_encrypt

Advertisement

Syntax Syntax

ParagonIE_Sodium_File::box_encrypt( resource $ifp, resource $ofp, int $mlen, string $nonce, string $boxKeypair )

Parameters Parameters

$ifp

(Required)

$ofp

(Required)

$mlen

(Required)

$nonce

(Required)

$boxKeypair

(Required)

Return Return

(bool)

Source Source

File: wp-includes/sodium_compat/src/File.php

    protected static function box_encrypt($ifp, $ofp, $mlen, $nonce, $boxKeypair)
    {
        if (PHP_INT_SIZE === 4) {
            return self::secretbox_encrypt(
                $ifp,
                $ofp,
                $mlen,
                $nonce,
                ParagonIE_Sodium_Crypto32::box_beforenm(
                    ParagonIE_Sodium_Crypto32::box_secretkey($boxKeypair),
                    ParagonIE_Sodium_Crypto32::box_publickey($boxKeypair)
                )
            );
        }
        return self::secretbox_encrypt(
            $ifp,
            $ofp,
            $mlen,
            $nonce,
            ParagonIE_Sodium_Crypto::box_beforenm(
                ParagonIE_Sodium_Crypto::box_secretkey($boxKeypair),
                ParagonIE_Sodium_Crypto::box_publickey($boxKeypair)
            )
        );
    }

Advertisement

Advertisement

Leave a Reply