Defuse\Crypto\File::encryptResource PHP Method

encryptResource() public static method

Takes two resource handles and encrypts the contents of the first, writing the ciphertext into the second.
public static encryptResource ( resource $inputHandle, resource $outputHandle, Defuse\Crypto\Key $key )
$inputHandle resource
$outputHandle resource
$key Defuse\Crypto\Key
    public static function encryptResource($inputHandle, $outputHandle, Key $key)
    {
        self::encryptResourceInternal($inputHandle, $outputHandle, KeyOrPassword::createFromKey($key));
    }

Usage Example

 /**
  * Encrypts a stream.
  *
  * @param resource $resource The stream to encrypt.
  *
  * @return resource The encrypted stream.
  */
 private function encryptStream($resource)
 {
     $out = fopen('php://temp', 'r+b');
     File::encryptResource($resource, $out, $this->key());
     rewind($out);
     return $out;
 }
All Usage Examples Of Defuse\Crypto\File::encryptResource