Compare commits

..

2 Commits

2 changed files with 12 additions and 9 deletions

View File

@ -225,15 +225,18 @@ class Link:
self.hash = self.link_id self.hash = self.link_id
def handshake(self): def handshake(self):
self.status = Link.HANDSHAKE if self.status == Link.PENDING and self.prv != None:
self.shared_key = self.prv.exchange(self.peer_pub) self.status = Link.HANDSHAKE
self.shared_key = self.prv.exchange(self.peer_pub)
self.derived_key = RNS.Cryptography.hkdf( self.derived_key = RNS.Cryptography.hkdf(
length=32, length=32,
derive_from=self.shared_key, derive_from=self.shared_key,
salt=self.get_salt(), salt=self.get_salt(),
context=self.get_context(), context=self.get_context(),
) )
else:
RNS.log("Handshake attempt on "+str(self)+" with invalid state "+str(self.status), RNS.LOG_ERROR)
def prove(self): def prove(self):

View File

@ -1,4 +1,4 @@
#!python3 #!/usr/bin/env python3
# MIT License # MIT License
# #