1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 12:08:59 +00:00

Verify the localback.net certificate

This commit is contained in:
Jochen Hoenicke 2015-03-05 11:15:53 +01:00
parent 9107aab76a
commit 6f59de799a

View File

@ -24,11 +24,11 @@ class BridgeTransport(Transport):
self.conn = requests.Session();
r = self.conn.post(TREZORD_HOST + '/configure', data=config, verify=None)
r = self.conn.post(TREZORD_HOST + '/configure', data=config)
if r.status_code != 200:
raise Exception('trezord: Could not configure' + get_error(r))
r = self.conn.get(TREZORD_HOST + '/enumerate', verify=None)
r = self.conn.get(TREZORD_HOST + '/enumerate')
if r.status_code != 200:
raise Exception('trezord: Could not enumerate devices' + get_error(r))
enum = r.json()
@ -43,14 +43,14 @@ class BridgeTransport(Transport):
super(BridgeTransport, self).__init__(device, *args, **kwargs)
def _open(self):
r = self.conn.post(TREZORD_HOST + '/acquire/%s' % self.path, verify=None)
r = self.conn.post(TREZORD_HOST + '/acquire/%s' % self.path)
if r.status_code != 200:
raise Exception('trezord: Could not acquire session' + get_error(r))
resp = r.json()
self.session = resp['session']
def _close(self):
r = self.conn.post(TREZORD_HOST + '/release/%s' % self.session, verify=None)
r = self.conn.post(TREZORD_HOST + '/release/%s' % self.session)
if r.status_code != 200:
raise Exception('trezord: Could not release session' + get_error(r))
else:
@ -63,7 +63,7 @@ class BridgeTransport(Transport):
cls = protobuf_msg.__class__.__name__
msg = protobuf_json.pb2json(protobuf_msg)
payload = '{"type": "%s", "message": %s}' % (cls, json.dumps(msg))
r = self.conn.post(TREZORD_HOST + '/call/%s' % self.session, data=payload, verify=None)
r = self.conn.post(TREZORD_HOST + '/call/%s' % self.session, data=payload)
if r.status_code != 200:
raise Exception('trezord: Could not write message' + get_error(r))
else: