mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-27 21:22:39 +01:00
Normalize fingerprints to allow more formats.
https://github.com/Limnoria/Limnoria-doc/issues/76#issuecomment-198794341
This commit is contained in:
parent
9cd2170a14
commit
93feb71b66
@ -131,9 +131,13 @@ def isIPV6(s):
|
||||
return False
|
||||
|
||||
|
||||
normalize_fingerprint = lambda fp: fp.replace(':', '').lower()
|
||||
|
||||
FINGERPRINT_ALGORITHMS = ('md5', 'sha1', 'sha224', 'sha256', 'sha384',
|
||||
'sha512')
|
||||
def check_certificate_fingerprint(conn, trusted_fingerprints):
|
||||
trusted_fingerprints = set(normalize_fingerprint(fp)
|
||||
for fp in trusted_fingerprints)
|
||||
cert = conn.getpeercert(binary_form=True)
|
||||
for algorithm in FINGERPRINT_ALGORITHMS:
|
||||
h = hashlib.new(algorithm)
|
||||
|
Loading…
Reference in New Issue
Block a user