signed blocks related crashes fixed hopefully
This commit is contained in:
parent
28e080fe1a
commit
5086a839ee
@ -277,7 +277,6 @@ class OnionrCommunicate:
|
||||
pass
|
||||
else:
|
||||
creator = self._utils.getPeerByHashId(blockMetadata['id'])
|
||||
logger.debug('Proccess blocks: verifying signature by ' + creator)
|
||||
if self._core._crypto.edVerify(blockContent.split(b'}')[1], creator, blockMetadata['sig'], encodedData=True):
|
||||
self._core.updateBlockInfo(i, 'sig', 'true')
|
||||
else:
|
||||
|
@ -44,7 +44,11 @@ class OnionrCrypto:
|
||||
|
||||
def edVerify(self, data, key, sig, encodedData=True):
|
||||
'''Verify signed data (combined in nacl) to an ed25519 key'''
|
||||
try:
|
||||
key = nacl.signing.VerifyKey(key=key, encoder=nacl.encoding.Base32Encoder)
|
||||
except nacl.bindings.crypto_sign_PUBLICKEYBYTES:
|
||||
logger.warn('Signature by unknown key (cannot reverse hash)')
|
||||
return False
|
||||
retData = False
|
||||
sig = base64.b64decode(sig)
|
||||
try:
|
||||
@ -56,6 +60,7 @@ class OnionrCrypto:
|
||||
retData = key.verify(data, sig) # .encode() is not the same as nacl.encoding
|
||||
except nacl.exceptions.BadSignatureError:
|
||||
pass
|
||||
|
||||
else:
|
||||
try:
|
||||
retData = key.verify(data, sig)
|
||||
|
Loading…
Reference in New Issue
Block a user