fixed broken deterministic addresses made it so we do not use forward secrecy when sending to self
parent
403150300e
commit
6b25a9301c
|
@ -718,7 +718,7 @@ class Core:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def insertBlock(self, data, header='txt', sign=False, encryptType='', symKey='', asymPeer='', meta = {}, expire=None):
|
def insertBlock(self, data, header='txt', sign=False, encryptType='', symKey='', asymPeer='', meta = {}, expire=None, disableForward=False):
|
||||||
'''
|
'''
|
||||||
Inserts a block into the network
|
Inserts a block into the network
|
||||||
encryptType must be specified to encrypt a block
|
encryptType must be specified to encrypt a block
|
||||||
|
@ -765,16 +765,17 @@ class Core:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if encryptType == 'asym':
|
if encryptType == 'asym':
|
||||||
try:
|
if not disableForward and asymPeer != self._crypto.pubKey:
|
||||||
forwardEncrypted = onionrusers.OnionrUser(self, asymPeer).forwardEncrypt(data)
|
try:
|
||||||
data = forwardEncrypted[0]
|
forwardEncrypted = onionrusers.OnionrUser(self, asymPeer).forwardEncrypt(data)
|
||||||
meta['forwardEnc'] = True
|
data = forwardEncrypted[0]
|
||||||
except onionrexceptions.InvalidPubkey:
|
meta['forwardEnc'] = True
|
||||||
pass
|
except onionrexceptions.InvalidPubkey:
|
||||||
#onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
pass
|
||||||
fsKey = onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
#onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
||||||
#fsKey = onionrusers.OnionrUser(self, asymPeer).getGeneratedForwardKeys().reverse()
|
fsKey = onionrusers.OnionrUser(self, asymPeer).generateForwardKey()
|
||||||
meta['newFSKey'] = fsKey
|
#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)
|
||||||
|
|
|
@ -210,12 +210,9 @@ class OnionrCrypto:
|
||||||
ops = nacl.pwhash.argon2id.OPSLIMIT_SENSITIVE
|
ops = nacl.pwhash.argon2id.OPSLIMIT_SENSITIVE
|
||||||
mem = nacl.pwhash.argon2id.MEMLIMIT_SENSITIVE
|
mem = nacl.pwhash.argon2id.MEMLIMIT_SENSITIVE
|
||||||
|
|
||||||
key = kdf(nacl.secret.SecretBox.KEY_SIZE, passphrase, salt, opslimit=ops, memlimit=mem)
|
key = kdf(32, passphrase, salt, opslimit=ops, memlimit=mem) # Generate seed for ed25519 key
|
||||||
key = nacl.public.PrivateKey(key, nacl.encoding.RawEncoder())
|
key = nacl.signing.SigningKey(key)
|
||||||
publicKey = key.public_key
|
return (key.verify_key.encode(nacl.encoding.Base32Encoder).decode(), key.encode(nacl.encoding.Base32Encoder).decode())
|
||||||
|
|
||||||
return (publicKey.encode(encoder=nacl.encoding.Base32Encoder()),
|
|
||||||
key.encode(encoder=nacl.encoding.Base32Encoder()))
|
|
||||||
|
|
||||||
def pubKeyHashID(self, pubkey=''):
|
def pubKeyHashID(self, pubkey=''):
|
||||||
'''Accept a ed25519 public key, return a truncated result of X many sha3_256 hash rounds'''
|
'''Accept a ed25519 public key, return a truncated result of X many sha3_256 hash rounds'''
|
||||||
|
|
Loading…
Reference in New Issue