further fixed forward secrecy

master
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] data = forwardEncrypted[0]
meta['forwardEnc'] = True meta['forwardEnc'] = True
expire = forwardEncrypted[2] # Expire time of key. no sense keeping block after that expire = forwardEncrypted[2] # Expire time of key. no sense keeping block after that
print(expire, self._utils.getEpoch())
except onionrexceptions.InvalidPubkey: except onionrexceptions.InvalidPubkey:
pass pass
#onionrusers.OnionrUser(self, asymPeer).generateForwardKey() #onionrusers.OnionrUser(self, asymPeer).generateForwardKey()

View File

@ -32,7 +32,20 @@ def deleteExpiredKeys(coreInst):
conn.close() conn.close()
return 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 = 604800
#DEFAULT_KEY_EXPIRE = 600
class OnionrUser: class OnionrUser:
def __init__(self, coreInst, publicKey, saveUser=False): def __init__(self, coreInst, publicKey, saveUser=False):
@ -149,7 +162,6 @@ class OnionrUser:
newPub = self._core._utils.bytesToStr(newKeys[0]) newPub = self._core._utils.bytesToStr(newKeys[0])
newPriv = self._core._utils.bytesToStr(newKeys[1]) newPriv = self._core._utils.bytesToStr(newKeys[1])
time = self._core._utils.getEpoch()
command = (self.publicKey, newPub, newPriv, time, expire + time) command = (self.publicKey, newPub, newPriv, time, expire + time)
c.execute("INSERT INTO myForwardKeys VALUES(?, ?, ?, ?, ?);", command) c.execute("INSERT INTO myForwardKeys VALUES(?, ?, ?, ?, ?);", command)

View File

@ -55,9 +55,6 @@ class OnionrFlow:
expireTime = self.myCore._utils.getEpoch() + 43200 expireTime = self.myCore._utils.getEpoch() + 43200
if len(message) > 0: if len(message) > 0:
self.myCore.insertBlock(message, header='txt', expire=expireTime, meta={'ch': self.channel}) 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") logger.info("Flow is exiting, goodbye")
return return