#!/usr/bin/python
+import hashlib as _hashlib
import re as _re
import subprocess as _subprocess
import struct as _struct
details = method()
return '{}: {}'.format(self['type'], details)
+ def _str_public_key_packet(self):
+ return self._str_generic_key_packet()
+
+ def _str_public_subkey_packet(self):
+ return self._str_generic_key_packet()
+
+ def _str_secret_key_packet(self):
+ return self._str_generic_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()
+
def _str_user_id_packet(self):
return self['user']
raise NotImplementedError(
'algorithm-specific key fields for {}'.format(
self['public-key-algorithm']))
+ fingerprint = _hashlib.sha1()
+ fingerprint.update(b'\x99')
+ fingerprint.update(_struct.pack('>H', len(data)))
+ fingerprint.update(data)
+ self['fingerprint'] = fingerprint.hexdigest()
return offset
def _parse_secret_key_packet(self, data):