def _parse_signature_packet(self, data):
self['signature-version'] = data[0]
offset = 1
- raise NotImplementedError(
- 'signature packet version {}'.format(
- self['signature-version']))
+ if self['signature-version'] != 4:
+ raise NotImplementedError(
+ 'signature packet version {}'.format(
+ self['signature-version']))
+ self['signature-type'] = self._signature_types[data[offset]]
+ offset += 1
+ self['public-key-algorithm'] = self._public_key_algorithms[
+ data[offset]]
+ offset += 1
+ self['hash-algorithm'] = self._hash_algorithms[data[offset]]
+ offset += 1
+ hashed_count = _struct.unpack('>H', data[offset: offset + 2])[0]
+ offset += 2
+ self['hashed-subpackets'] = data[offset: offset + hashed_count]
+ offset += hashed_count
+ unhashed_count = _struct.unpack('>H', data[offset: offset + 2])[0]
+ offset += 2
+ self['unhashed-subpackets'] = data[offset: offset + unhashed_count]
+ offset += unhashed_count
+ self['signed-hash-word'] = data[offset: offset + 2]
+ offset += 2
+ self['signature'] = data[offset:]
def to_bytes(self):
pass