Open GrimmSnark opened 2 months ago
Hi @GrimmSnark
I haven't personally tested on windows, so this might be OS-specific.
Please try running the following script. On my Linux machine it succeeds and prints "Success". I'm curious on whether it works for you on windows. We can take it from there.
def _generate_keypair():
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
privk = Ed25519PrivateKey.generate()
pubk = privk.public_key()
private_key_hex = privk.private_bytes(
encoding=serialization.Encoding.Raw,
format=serialization.PrivateFormat.Raw,
encryption_algorithm=serialization.NoEncryption()
).hex()
public_key_hex = pubk.public_bytes(
encoding=serialization.Encoding.Raw,
format=serialization.PublicFormat.Raw
).hex()
test_msg = b'123'
test_signature = _sign_message(test_msg, public_key_hex, private_key_hex)
assert _verify_signature(test_msg, public_key_hex, test_signature)
return public_key_hex, private_key_hex
def _verify_signature(msg: bytes, public_key_hex: str, signature: str):
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
pubk = Ed25519PublicKey.from_public_bytes(bytes.fromhex(public_key_hex))
try:
pubk.verify(bytes.fromhex(signature), msg)
except Exception:
return False
return True
def _sign_message(msg: bytes, public_key_hex: str, private_key_hex: str) -> str:
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey, Ed25519PublicKey
privk = Ed25519PrivateKey.from_private_bytes(bytes.fromhex(private_key_hex))
pubk = Ed25519PublicKey.from_public_bytes(bytes.fromhex(public_key_hex))
signature = privk.sign(msg).hex()
pubk.verify(bytes.fromhex(signature), msg)
return signature
public_key_hex, private_key_hex = _generate_keypair()
_sign_message(b'123', public_key_hex, private_key_hex)
print('Success')
Hello,
So I am trying to get sortingview working for spikeinterface. However when I run the
kachery-cloud-init
I get the following error. Any advice would be greatly appreciated.