commit eaa871fa08b3920baa9d24b3338c7c4b6973ee40 Author: Dave Rolek dmr-x@riseup.net Date: Sat Aug 18 04:12:35 2018 +0000
Now use the decrypt method in our Circuit class
This also now actually checks the 'recognized' field and digest, unlike before.
Keep in mind that this implementation is really meant for illustrative purposes, in the interim. (There are some limitations to it.) --- stem/client/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/stem/client/__init__.py b/stem/client/__init__.py index a228bebc..33ac0d8d 100644 --- a/stem/client/__init__.py +++ b/stem/client/__init__.py @@ -255,8 +255,11 @@ class Circuit(object): elif raw_cell.circ_id != self.id: raise stem.ProtocolError('Response should be for circuit id %i, not %i' % (self.id, raw_cell.circ_id))
- decrypted_payload = self.backward_key.update(raw_cell.payload) - reply_cells.append(stem.client.cell.RelayCell._unpack(decrypted_payload, self.id, self.relay.link_protocol)) + decrypted_cell, fully_decrypted, self.backward_digest, self.backward_key = raw_cell.decrypt(self.backward_digest, self.backward_key, interpret = True) + if not fully_decrypted: + raise stem.ProtocolError('Response for circuit id %i was not fully decrypted, when expected to be' % self.id) + + reply_cells.append(decrypted_cell)
return reply_cells except:
tor-commits@lists.torproject.org