in api/plugins/crypto.py [0:0]
def fingerprint(key):
""" Derives a digest fingerprint from a key """
if isinstance(key, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey):
_pem = pem(key)
elif type(key) is str:
_pem = bytes(key, 'ascii', errors = 'replace')
else:
_pem = key
sha = hashlib.sha224(_pem).hexdigest()
return sha