def _str_public_subkey_packet(self):
return self._str_generic_key_packet()
+ def _str_generic_key_packet(self):
+ return self['fingerprint'][-8:].upper()
+
def _str_secret_key_packet(self):
- return self._str_generic_key_packet()
+ return self._str_generic_secret_key_packet()
def _str_secret_subkey_packet(self):
- return self._str_generic_key_packet()
-
- def _str_generic_key_packet(self):
- return self['fingerprint'][-8:].upper()
+ return self._str_generic_secret_key_packet()
+
+ def _str_generic_secret_key_packet(self):
+ lines = [self._str_generic_key_packet()]
+ for label, key in [
+ ('symmetric encryption',
+ 'symmetric-encryption-algorithm'),
+ ('s2k hash', 'string-to-key-hash-algorithm'),
+ ('s2k count', 'string-to-key-count'),
+ ('s2k salt', 'string-to-key-salt'),
+ ('IV', 'initial-vector'),
+ ]:
+ if key in self:
+ value = self[key]
+ if isinstance(value, bytes):
+ value = ' '.join('{:02x}'.format(byte) for byte in value)
+ lines.append(' {}: {}'.format(label, value))
+ return '\n'.join(lines)
def _str_signature_packet(self):
lines = [self['signature-type']]