encode/decode
This commit is contained in:
parent
26d3f1f8fb
commit
1e09e70574
7 changed files with 22 additions and 16 deletions
10
oml/utils.py
10
oml/utils.py
|
|
@ -114,9 +114,15 @@ def valid(key, value, sig):
|
|||
'''
|
||||
validate that value was signed by key
|
||||
'''
|
||||
vk = ed25519.VerifyingKey(str(key), encoding=ENCODING)
|
||||
if isinstance(sig, str):
|
||||
sig = sig.encode()
|
||||
if isinstance(value, str):
|
||||
value = value.encode()
|
||||
if isinstance(key, str):
|
||||
key = key.encode()
|
||||
vk = ed25519.VerifyingKey(key, encoding=ENCODING)
|
||||
try:
|
||||
vk.verify(str(sig), str(value), encoding=ENCODING)
|
||||
vk.verify(sig, value, encoding=ENCODING)
|
||||
#except ed25519.BadSignatureError:
|
||||
except:
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue