public static function decrypt(
        $input,
        $output,
        EncryptionKey $key
    ): bool {
        if (
            (\is_resource($input) || \is_string($input) || ($input instanceof ReadOnlyFile))
                &&
            (\is_resource($output) || \is_string($output) || ($output instanceof MutableFile))
        ) {
            try {
                if ($input instanceof ReadOnlyFile) {
                    $readOnly = $input;
                } else {
                    $readOnly = new ReadOnlyFile($input);
                }
                if ($output instanceof MutableFile) {
                    $mutable = $output;
                } else {
                    $mutable = new MutableFile($output);
                }
                $data = self::decryptData(
                    $readOnly,
                    $mutable,
                    $key
                );
                return $data;
            } finally {
                if (isset($readOnly)) {
                    $readOnly->close();
                }
                if (isset($mutable)) {
                    $mutable->close();
                }
            }
        }
        throw new InvalidType(
            'Strings or file handles expected'
        );
    }
public static function decrypt(
        $input,
        $output,
        EncryptionKey $key
    ): bool {
        if (
            (\is_resource($input) || \is_string($input) || ($input instanceof ReadOnlyFile))
                &&
            (\is_resource($output) || \is_string($output) || ($output instanceof MutableFile))
        ) {
            try {
                if ($input instanceof ReadOnlyFile) {
                    $readOnly = $input;
                } else {
                    $readOnly = new ReadOnlyFile($input);
                }
                if ($output instanceof MutableFile) {
                    $mutable = $output;
                } else {
                    $mutable = new MutableFile($output);
                }
                $data = self::decryptData(
                    $readOnly,
                    $mutable,
                    $key
                );
                return $data;
            } finally {
                if (isset($readOnly)) {
                    $readOnly->close();
                }
                if (isset($mutable)) {
                    $mutable->close();
                }
            }
        }
        throw new InvalidType(
            'Strings or file handles expected'
        );
    }
public static function decrypt ( $ input , $ output , EncryptionKey $ key ) : bool { if ( ( \ is_resource ( $ input ) || \ is_string ( $ input ) || ( $ input instanceof ReadOnlyFile ) ) && ( \ is_resource ( $ output ) || \ is_string ( $ output ) || ( $ output instanceof MutableFile ) ) ) { try { if ( $ input instanceof ReadOnlyFile ) { $ readOnly = $ input ; } else { $ readOnly = new ReadOnlyFile ( $ input ) ; } if ( $ output instanceof MutableFile ) { $ mutable = $ output ; } else { $ mutable = new MutableFile ( $ output ) ; } $ data = self :: decryptData ( $ readOnly , $ mutable , $ key ) ; return $ data ; } finally { if ( isset ( $ readOnly ) ) { $ readOnly -> close ( ) ; } if ( isset ( $ mutable ) ) { $ mutable -> close ( ) ; } } } throw new InvalidType ( 'Strings or file handles expected' ) ; }
Decrypt a file using symmetric-key authenticated encryption.

@param string|resource|ReadOnlyFile $input Input file
@param string|resource|MutableFile $output Output file
@param EncryptionKey $key                  Symmetric encryption key
@return bool                               TRUE if successful

@throws CannotPerformOperation
@throws FileAccessDenied
@throws FileError
@throws FileModified
@throws InvalidDigestLength
@throws InvalidKey
@throws InvalidMessage
@throws InvalidType
@throws \TypeError
Decrypt a file using symmetric - key authenticated encryption .