src/lib/Herrera/Box/Signature.php
public function verify()
    {
        $signature = $this->get();

        $size = $this->size;
        $type = null;

        foreach (self::$types as $type) {
            if ($type['name'] === $signature['hash_type']) {
                if (0x10 === $type['flag']) {
                    $this->seek(-12, SEEK_END);

                    $less = $this->read(4);
                    $less = unpack('V', $less);
                    $less = $less[1];

                    $size -= 12 + $less;
                } else {
                    $size -= 8 + $type['size'];
                }

                break;
            }
        }

        $this->seek(0);

        /** @var $verify VerifyInterface */
        $verify = new $type['class']();
        $verify->init($type['name'], $this->file);

        $buffer = 64;

        while (0 < $size) {
            if ($size < $buffer) {
                $buffer = $size;
                $size = 0;
            }

            $verify->update($this->read($buffer));

            $size -= $buffer;
        }

        return $verify->verify($signature['hash']);
    }
public function verify()
    {
        $signature = $this->get();

        $size = $this->size;
        $type = null;

        foreach (self::$types as $type) {
            if ($type['name'] === $signature['hash_type']) {
                if (0x10 === $type['flag']) {
                    $this->seek(-12, SEEK_END);

                    $less = $this->read(4);
                    $less = unpack('V', $less);
                    $less = $less[1];

                    $size -= 12 + $less;
                } else {
                    $size -= 8 + $type['size'];
                }

                break;
            }
        }

        $this->seek(0);

        /** @var $verify VerifyInterface */
        $verify = new $type['class']();
        $verify->init($type['name'], $this->file);

        $buffer = 64;

        while (0 < $size) {
            if ($size < $buffer) {
                $buffer = $size;
                $size = 0;
            }

            $verify->update($this->read($buffer));

            $size -= $buffer;
        }

        return $verify->verify($signature['hash']);
    }
public function verify ( ) { $ signature = $ this -> get ( ) ; $ size = $ this -> size ; $ type = null ; foreach ( self :: $ types as $ type ) { if ( $ type [ 'name' ] === $ signature [ 'hash_type' ] ) { if ( 0x10 === $ type [ 'flag' ] ) { $ this -> seek ( - 12 , SEEK_END ) ; $ less = $ this -> read ( 4 ) ; $ less = unpack ( 'V' , $ less ) ; $ less = $ less [ 1 ] ; $ size -= 12 + $ less ; } else { $ size -= 8 + $ type [ 'size' ] ; } break ; } } $ this -> seek ( 0 ) ; /** @var $verify VerifyInterface */ $ verify = new $ type [ 'class' ] ( ) ; $ verify -> init ( $ type [ 'name' ] , $ this -> file ) ; $ buffer = 64 ; while ( 0 < $ size ) { if ( $ size < $ buffer ) { $ buffer = $ size ; $ size = 0 ; } $ verify -> update ( $ this -> read ( $ buffer ) ) ; $ size -= $ buffer ; } return $ verify -> verify ( $ signature [ 'hash' ] ) ; }
Verifies the signature of the phar.

@return boolean TRUE if verified, FALSE if not.

@throws Exception
@throws FileException    If the private key could not be read.
@throws OpenSslException If there is an OpenSSL error.
Verifies the signature of the phar .