You are here

protected static function ParagonIE_Sodium_File::box_encrypt in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/File.php \ParagonIE_Sodium_File::box_encrypt()

Parameters

resource $ifp:

resource $ofp:

int $mlen:

string $nonce:

string $boxKeypair:

Return value

bool

Throws

SodiumException

TypeError

2 calls to ParagonIE_Sodium_File::box_encrypt()
ParagonIE_Sodium_File::box in vendor/paragonie/sodium_compat/src/File.php
Box a file (rather than a string). Uses less memory than ParagonIE_Sodium_Compat::crypto_box(), but produces the same result.
ParagonIE_Sodium_File::box_seal in vendor/paragonie/sodium_compat/src/File.php
Seal a file (rather than a string). Uses less memory than ParagonIE_Sodium_Compat::crypto_box_seal(), but produces the same result.

File

vendor/paragonie/sodium_compat/src/File.php, line 767

Class

ParagonIE_Sodium_File
Class ParagonIE_Sodium_File

Code

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)));
}