OpenPGP_SignaturePacket::read PHP Method

read() public method

public read ( )
    function read()
    {
        switch ($this->version = ord($this->read_byte())) {
            case 2:
            case 3:
                assert(ord($this->read_byte()) == 5);
                $this->signature_type = ord($this->read_byte());
                $creation_time = $this->read_timestamp();
                $keyid = $this->read_bytes(8);
                $keyidHex = '';
                for ($i = 0; $i < strlen($keyid); $i++) {
                    // Store KeyID in Hex
                    $keyidHex .= sprintf('%02X', ord($keyid[$i]));
                }
                $this->hashed_subpackets = array();
                $this->unhashed_subpackets = array(new OpenPGP_SignaturePacket_SignatureCreationTimePacket($creation_time), new OpenPGP_SignaturePacket_IssuerPacket($keyidHex));
                $this->key_algorithm = ord($this->read_byte());
                $this->hash_algorithm = ord($this->read_byte());
                $this->hash_head = $this->read_unpacked(2, 'n');
                $this->data = array();
                while (strlen($this->input) > 0) {
                    $this->data[] = $this->read_mpi();
                }
                /* Horde change */
                /* v3 Signature trailer (RFC 4880 [5.2.4]) */
                $this->trailer = chr($this->signature_type) . pack('N', $creation_time);
                /* End horde change. */
                break;
            case 4:
                $this->signature_type = ord($this->read_byte());
                $this->key_algorithm = ord($this->read_byte());
                $this->hash_algorithm = ord($this->read_byte());
                $this->trailer = chr(4) . chr($this->signature_type) . chr($this->key_algorithm) . chr($this->hash_algorithm);
                $hashed_size = $this->read_unpacked(2, 'n');
                $hashed_subpackets = $this->read_bytes($hashed_size);
                $this->trailer .= pack('n', $hashed_size) . $hashed_subpackets;
                $this->hashed_subpackets = self::get_subpackets($hashed_subpackets);
                $this->trailer .= chr(4) . chr(0xff) . pack('N', 6 + $hashed_size);
                $unhashed_size = $this->read_unpacked(2, 'n');
                $this->unhashed_subpackets = self::get_subpackets($this->read_bytes($unhashed_size));
                $this->hash_head = $this->read_unpacked(2, 'n');
                $this->data = array();
                while (strlen($this->input) > 0) {
                    $this->data[] = $this->read_mpi();
                }
                break;
        }
    }