half way done with encryption plugin, fixed encryption bug in onionrcrypto when using non anonymous encryption
parent
fbd82d38fe
commit
220fda02ce
|
@ -732,6 +732,7 @@ class Core:
|
||||||
onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
||||||
else:
|
else:
|
||||||
logger.info(forwardEncrypted)
|
logger.info(forwardEncrypted)
|
||||||
|
onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
||||||
fsKey = onionrusers.OnionrUser(self, asymPeer).getGeneratedForwardKeys()[0]
|
fsKey = onionrusers.OnionrUser(self, asymPeer).getGeneratedForwardKeys()[0]
|
||||||
meta['newFSKey'] = fsKey[0]
|
meta['newFSKey'] = fsKey[0]
|
||||||
jsonMeta = json.dumps(meta)
|
jsonMeta = json.dumps(meta)
|
||||||
|
|
|
@ -128,7 +128,7 @@ class OnionrCrypto:
|
||||||
encoding = nacl.encoding.RawEncoder
|
encoding = nacl.encoding.RawEncoder
|
||||||
|
|
||||||
if self.privKey != None and not anonymous:
|
if self.privKey != None and not anonymous:
|
||||||
ownKey = nacl.signing.SigningKey(seed=self.privKey, encoder=nacl.encoding.Base32Encoder)
|
ownKey = nacl.signing.SigningKey(seed=self.privKey, encoder=nacl.encoding.Base32Encoder).to_curve25519_private_key()
|
||||||
key = nacl.signing.VerifyKey(key=pubkey, encoder=nacl.encoding.Base32Encoder).to_curve25519_public_key()
|
key = nacl.signing.VerifyKey(key=pubkey, encoder=nacl.encoding.Base32Encoder).to_curve25519_public_key()
|
||||||
ourBox = nacl.public.Box(ownKey, key)
|
ourBox = nacl.public.Box(ownKey, key)
|
||||||
retVal = ourBox.encrypt(data.encode(), encoder=encoding)
|
retVal = ourBox.encrypt(data.encode(), encoder=encoding)
|
||||||
|
|
|
@ -58,6 +58,7 @@ class OnionrUser:
|
||||||
def forwardEncrypt(self, data):
|
def forwardEncrypt(self, data):
|
||||||
retData = ''
|
retData = ''
|
||||||
forwardKey = self._getLatestForwardKey()
|
forwardKey = self._getLatestForwardKey()
|
||||||
|
logger.info('using ' + forwardKey)
|
||||||
if self._core._utils.validatePubKey(forwardKey):
|
if self._core._utils.validatePubKey(forwardKey):
|
||||||
retData = self._core._crypto.pubKeyEncrypt(data, forwardKey, encodedData=True, anonymous=True)
|
retData = self._core._crypto.pubKeyEncrypt(data, forwardKey, encodedData=True, anonymous=True)
|
||||||
else:
|
else:
|
||||||
|
@ -87,7 +88,7 @@ class OnionrUser:
|
||||||
conn = sqlite3.connect(self._core.peerDB, timeout=10)
|
conn = sqlite3.connect(self._core.peerDB, timeout=10)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
|
|
||||||
for row in c.execute("SELECT forwardKey FROM forwardKeys WHERE peerKey = ? AND date=(SELECT max(date) FROM forwardKeys)", (self.publicKey,)):
|
for row in c.execute("SELECT forwardKey FROM forwardKeys WHERE peerKey = ? order by date desc", (self.publicKey,)):
|
||||||
key = row[0]
|
key = row[0]
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ class OnionrUser:
|
||||||
conn = sqlite3.connect(self._core.peerDB, timeout=10)
|
conn = sqlite3.connect(self._core.peerDB, timeout=10)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
keyList = []
|
keyList = []
|
||||||
for row in c.execute("SELECT forwardKey FROM forwardKeys WHERE peerKey = ?", (self.publicKey,)):
|
for row in c.execute("SELECT forwardKey FROM forwardKeys WHERE peerKey = ? order by date desc", (self.publicKey,)):
|
||||||
key = row[0]
|
key = row[0]
|
||||||
keyList.append(key)
|
keyList.append(key)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue