public static function verify(
        $filename,
        SignaturePublicKey $publicKey,
        string $signature,
        $encoding = Halite::ENCODE_BASE64URLSAFE
    ): bool {
        if ($filename instanceof ReadOnlyFile) {
            $pos = $filename->getPos();
            $filename->reset(0);
            $verified = self::verifyData(
                $filename,
                $publicKey,
                $signature,
                $encoding
            );
            $filename->reset($pos);
            return $verified;
        }
        if (\is_resource($filename) || \is_string($filename)) {
            $readOnly = new ReadOnlyFile($filename);
            try {
                $verified = self::verifyData(
                    $readOnly,
                    $publicKey,
                    $signature,
                    $encoding
                );
                return $verified;
            } finally {
                if (isset($readOnly)) {
                    $readOnly->close();
                }
            }
        }
        throw new InvalidType(
            'Argument 1: Expected a filename or resource'
        );
    }
public static function verify(
        $filename,
        SignaturePublicKey $publicKey,
        string $signature,
        $encoding = Halite::ENCODE_BASE64URLSAFE
    ): bool {
        if ($filename instanceof ReadOnlyFile) {
            $pos = $filename->getPos();
            $filename->reset(0);
            $verified = self::verifyData(
                $filename,
                $publicKey,
                $signature,
                $encoding
            );
            $filename->reset($pos);
            return $verified;
        }
        if (\is_resource($filename) || \is_string($filename)) {
            $readOnly = new ReadOnlyFile($filename);
            try {
                $verified = self::verifyData(
                    $readOnly,
                    $publicKey,
                    $signature,
                    $encoding
                );
                return $verified;
            } finally {
                if (isset($readOnly)) {
                    $readOnly->close();
                }
            }
        }
        throw new InvalidType(
            'Argument 1: Expected a filename or resource'
        );
    }
public static function verify ( $ filename , SignaturePublicKey $ publicKey , string $ signature , $ encoding = Halite :: ENCODE_BASE64URLSAFE ) : bool { if ( $ filename instanceof ReadOnlyFile ) { $ pos = $ filename -> getPos ( ) ; $ filename -> reset ( 0 ) ; $ verified = self :: verifyData ( $ filename , $ publicKey , $ signature , $ encoding ) ; $ filename -> reset ( $ pos ) ; return $ verified ; } if ( \ is_resource ( $ filename ) || \ is_string ( $ filename ) ) { $ readOnly = new ReadOnlyFile ( $ filename ) ; try { $ verified = self :: verifyData ( $ readOnly , $ publicKey , $ signature , $ encoding ) ; return $ verified ; } finally { if ( isset ( $ readOnly ) ) { $ readOnly -> close ( ) ; } } } throw new InvalidType ( 'Argument 1: Expected a filename or resource' ) ; }
Verify a digital signature for a file.

@param string|resource|ReadOnlyFile $filename     File name or file handle
@param SignaturePublicKey $publicKey Other party's signature public key
@param string $signature             The signature we received
@param mixed $encoding               Which encoding scheme to use for the signature?

@return bool
@throws CannotPerformOperation
@throws FileAccessDenied
@throws FileError
@throws InvalidKey
@throws InvalidMessage
@throws InvalidSignature
@throws InvalidType
@throws \TypeError
Verify a digital signature for a file .