Old pyOpenSSL is missing get_signature_algorithm. Use the default "sha256"

signature algorithm for old pyOpenSSL.

Fixes #7641
This commit is contained in:
Fedor Brunner 2014-02-16 17:41:31 +01:00
parent 82265425b7
commit 700cbeb13f
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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