fixed broken forward secrecy (not sharing new keys)
parent
c5a0b29988
commit
8c72242eaf
|
@ -182,7 +182,7 @@ class Core:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
logger.debug('Invalid ID: %s' % address)
|
#logger.debug('Invalid ID: %s' % address)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def removeAddress(self, address):
|
def removeAddress(self, address):
|
||||||
|
@ -739,10 +739,11 @@ class Core:
|
||||||
data = forwardEncrypted[0]
|
data = forwardEncrypted[0]
|
||||||
meta['forwardEnc'] = True
|
meta['forwardEnc'] = True
|
||||||
except onionrexceptions.InvalidPubkey:
|
except onionrexceptions.InvalidPubkey:
|
||||||
onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
pass
|
||||||
onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
#onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
||||||
fsKey = onionrusers.OnionrUser(self, asymPeer).getGeneratedForwardKeys()[0]
|
fsKey = onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
||||||
meta['newFSKey'] = fsKey[0]
|
#fsKey = onionrusers.OnionrUser(self, asymPeer).getGeneratedForwardKeys().reverse()
|
||||||
|
meta['newFSKey'] = fsKey
|
||||||
jsonMeta = json.dumps(meta)
|
jsonMeta = json.dumps(meta)
|
||||||
if sign:
|
if sign:
|
||||||
signature = self._crypto.edSign(jsonMeta.encode() + data, key=self._crypto.privKey, encodeResult=True)
|
signature = self._crypto.edSign(jsonMeta.encode() + data, key=self._crypto.privKey, encodeResult=True)
|
||||||
|
|
|
@ -169,7 +169,9 @@ class OnionrUser:
|
||||||
|
|
||||||
def addForwardKey(self, newKey, expire=604800):
|
def addForwardKey(self, newKey, expire=604800):
|
||||||
if not self._core._utils.validatePubKey(newKey):
|
if not self._core._utils.validatePubKey(newKey):
|
||||||
raise onionrexceptions.InvalidPubkey
|
raise onionrexceptions.InvalidPubkey(newKey)
|
||||||
|
if newKey in self._getForwardKeys():
|
||||||
|
return False
|
||||||
# Add a forward secrecy key for the peer
|
# Add a forward secrecy key for the peer
|
||||||
conn = sqlite3.connect(self._core.peerDB, timeout=10)
|
conn = sqlite3.connect(self._core.peerDB, timeout=10)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
|
|
Loading…
Reference in New Issue