-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup issue #234
Comments
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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.The text was updated successfully, but these errors were encountered: