Old pyOpenSSL is missing get_signature_algorithm. Use the default "sha256"
signature algorithm for old pyOpenSSL. Fixes #7641
This commit is contained in:
		
							parent
							
								
									82265425b7
								
							
						
					
					
						commit
						700cbeb13f
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue