Browse Source

fix: dePem cert before parsing

283
ThomasV 10 years ago
parent
commit
85d9b8aa8d
  1. 7
      lib/interface.py

7
lib/interface.py

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

Loading…
Cancel
Save