* work on new block system, encryption

+ added new exception
+ encryption now anonymous by default, will probably remove anonymous
param in future
This commit is contained in:
Kevin Froman 2018-06-20 02:40:49 -05:00
parent 10ebdddb24
commit 0a8052a9a4
No known key found for this signature in database
GPG key ID: 0D414D0FE405B63B
3 changed files with 17 additions and 1 deletions

View file

@ -700,8 +700,20 @@ class Core:
if len(symKey) < self.requirements.passwordLength:
raise onionrexceptions.SecurityError('Weak encryption key')
jsonMeta = self._crypto.symmetricEncrypt(jsonMeta, key=symKey, returnEncoded=True)
data = self._crypto.symmetricEncrypt(data, key=symKey, returnEncoded=True)
signature = self._crypto.symmetricEncrypt(signature, key=symKey, returnEncoded=True)
signer = self._crypto.symmetricEncrypt(signer, key=symKey, returnEncoded=True)
elif encryptType == 'asym':
if self._utils.validatePubKey(asymPeer):
jsonMeta = self._crypto.pubKeyEncrypt(jsonMeta, asymPeer, encodedData=True)
data = self._crypto.pubKeyEncrypt(data, asymPeer, encodedData=True)
signature = self._crypto.pubKeyEncrypt(signature, asymPeer, encodedData=True)
else:
raise onionrexceptions.InvalidPubkey(asymPeer + ' is not a valid base32 encoded ed25519 key')
metadata['meta'] = jsonMeta
metadata['sig'] = signature
metadata['signer'] = signer
powProof = onionrproofs.POW(data)
powToken = ''