commit 85d9b8aa8dadac5e1d7f305b1258f9550c743b9f
parent ca3c320ef42839f373ff1f9e00d6756a444419d7
Author: ThomasV <thomasv@gitorious>
Date: Fri, 7 Aug 2015 11:58:59 +0200
fix: dePem cert before parsing
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/interface.py b/lib/interface.py
@@ -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