summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Pasquet <mathieui@mathieui.net>2014-01-28 18:54:46 +0100
committerMathieu Pasquet <mathieui@mathieui.net>2014-01-28 18:54:46 +0100
commit2ac24d6883214018e97838da8846ebf3a1223058 (patch)
tree1d4e118fff7bcb30b9e90d020304520a44d3f7a4
parentf9e70fa656edc0af4477a90d3ec9122faa9bce15 (diff)
downloadpoezio-2ac24d6883214018e97838da8846ebf3a1223058.tar.gz
poezio-2ac24d6883214018e97838da8846ebf3a1223058.tar.bz2
poezio-2ac24d6883214018e97838da8846ebf3a1223058.tar.xz
poezio-2ac24d6883214018e97838da8846ebf3a1223058.zip
Provide a more standardized fingerprint representation
(also includes silent modification of the hash already in the config)
-rw-r--r--src/core.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py
index a2e59aa4..d481ae6a 100644
--- a/src/core.py
+++ b/src/core.py
@@ -3750,8 +3750,14 @@ class Core(object):
if config.get('ignore_certificate', 'false').lower() == 'true':
return
cert = config.get('certificate', '')
+ # update the cert representation when it uses the old one
+ if cert and not ':' in cert:
+ cert = ':'.join(i + j for i, j in zip(cert[::2], cert[1::2])).upper()
+ config.set_and_save('certificate', cert)
+
der = ssl.PEM_cert_to_DER_cert(pem)
- found_cert = sha1(der).hexdigest()
+ digest = sha1(der).hexdigest().upper()
+ found_cert = ':'.join(i + j for i, j in zip(digest[::2], digest[1::2]))
if cert:
if found_cert == cert:
log.debug('Cert %s OK', found_cert)