further fixed forward secrecy

This commit is contained in:
Kevin Froman 2019-03-13 23:51:29 -05:00
parent 6568086e24
commit 4757bb0963
3 changed files with 13 additions and 5 deletions

View File

@ -738,7 +738,6 @@ class Core:
data = forwardEncrypted[0]
meta['forwardEnc'] = True
expire = forwardEncrypted[2] # Expire time of key. no sense keeping block after that
print(expire, self._utils.getEpoch())
except onionrexceptions.InvalidPubkey:
pass
#onionrusers.OnionrUser(self, asymPeer).generateForwardKey()

View File

@ -32,7 +32,20 @@ def deleteExpiredKeys(coreInst):
conn.close()
return
def deleteTheirExpiredKeys(coreInst, pubkey):
conn = sqlite3.connect(self._core.peerDB, timeout=10)
c = conn.cursor()
# Prepare the insert
command = (pubkey, coreInst._utils.getEpoch())
c.execute("DELETE from forwardKeys where peerKey = ? and expire <= ?", command)
conn.commit()
conn.close()
DEFAULT_KEY_EXPIRE = 604800
#DEFAULT_KEY_EXPIRE = 600
class OnionrUser:
def __init__(self, coreInst, publicKey, saveUser=False):
@ -149,7 +162,6 @@ class OnionrUser:
newPub = self._core._utils.bytesToStr(newKeys[0])
newPriv = self._core._utils.bytesToStr(newKeys[1])
time = self._core._utils.getEpoch()
command = (self.publicKey, newPub, newPriv, time, expire + time)
c.execute("INSERT INTO myForwardKeys VALUES(?, ?, ?, ?, ?);", command)

View File

@ -55,9 +55,6 @@ class OnionrFlow:
expireTime = self.myCore._utils.getEpoch() + 43200
if len(message) > 0:
self.myCore.insertBlock(message, header='txt', expire=expireTime, meta={'ch': self.channel})
#insertBL = Block(content = message, type = 'txt', expire=expireTime, core = self.myCore)
#insertBL.setMetadata('ch', self.channel)
#insertBL.save()
logger.info("Flow is exiting, goodbye")
return