From 700cbeb13f86684cf35a2cad0629fb0011c90a52 Mon Sep 17 00:00:00 2001 From: Fedor Brunner Date: Sun, 16 Feb 2014 17:41:31 +0100 Subject: [PATCH] Old pyOpenSSL is missing get_signature_algorithm. Use the default "sha256" signature algorithm for old pyOpenSSL. Fixes #7641 --- src/common/jingle_content.py | 6 +++++- src/common/jingle_xtls.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/jingle_content.py b/src/common/jingle_content.py index 2634957c6..ccdb4e526 100644 --- a/src/common/jingle_content.py +++ b/src/common/jingle_content.py @@ -220,7 +220,11 @@ class JingleContent(object): + '.cert' cert = load_cert_file(certpath) if cert: - digest_algo = cert.get_signature_algorithm().split('With')[0] + try: + digest_algo = cert.get_signature_algorithm().split('With')[0] + except AttributeError, e: + # Old py-OpenSSL is missing get_signature_algorithm + digest_algo = "sha256" security.addChild('fingerprint').addData(cert.digest( digest_algo)) for m in ('x509', ): # supported authentication methods diff --git a/src/common/jingle_xtls.py b/src/common/jingle_xtls.py index a55140252..6caa427f3 100644 --- a/src/common/jingle_xtls.py +++ b/src/common/jingle_xtls.py @@ -192,7 +192,11 @@ def check_cert(jid, fingerprint): if os.path.exists(certpath): cert = load_cert_file(certpath) if cert: - digest_algo = cert.get_signature_algorithm().split('With')[0] + try: + digest_algo = cert.get_signature_algorithm().split('With')[0] + except AttributeError, e: + # Old py-OpenSSL is missing get_signature_algorithm + digest_algo = "sha256" if cert.digest(digest_algo) == fingerprint: return True return False