fix: dePem cert before parsing

This commit is contained in:
ThomasV 2015-08-07 11:58:59 +02:00
parent ca3c320ef4
commit 85d9b8aa8d
1 changed files with 5 additions and 2 deletions

View File

@ -27,6 +27,7 @@ ca_path = requests.certs.where()
import util
import x509
import pem
from version import ELECTRUM_VERSION, PROTOCOL_VERSION
from simple_config import SimpleConfig
@ -201,7 +202,8 @@ class TcpInterface(threading.Thread):
with open(cert_path) as f:
cert = f.read()
try:
x = x509.X509(cert)
b = pem.dePem(cert, 'CERTIFICATE')
x = x509.X509(b)
except:
traceback.print_exc(file=sys.stderr)
self.print_error("wrong certificate")
@ -342,7 +344,8 @@ def check_host_name(peercert, name):
def check_cert(host, cert):
try:
x = x509.X509(cert)
b = pem.dePem(cert, 'CERTIFICATE')
x = x509.X509(b)
except:
traceback.print_exc(file=sys.stdout)
return