'algorithm-specific key fields for {}'.format(
self['public-key-algorithm']))
fingerprint = _hashlib.sha1()
- fingerprint_target = self
- if self['type'] != 'public-key packet':
- fingerprint_target = self.copy()
- fingerprint_target['type'] = 'public-key packet'
fingerprint.update(
- self._serialize_signature_packet_target(target=fingerprint_target))
+ self._serialize_signature_packet_target(target=self))
self['fingerprint'] = fingerprint.hexdigest()
return offset
elif isinstance(target, bytes):
return target
elif isinstance(target, PGPPacket):
+ if target['type'] in [
+ 'public-subkey packet',
+ 'secret-key packet',
+ 'secret-subkey packet',
+ ]:
+ target = target.copy()
+ target['type'] = 'public-key packet'
serialized = target._serialize_body()
if target['type'] in [
'public-key packet',