Skip to content

Instantly share code, notes, and snippets.

@MEXAHOTABOP
Last active February 29, 2024 11:57
Show Gist options
  • Save MEXAHOTABOP/e7b6d25a9fb9115ddd20822d420e97b9 to your computer and use it in GitHub Desktop.
Save MEXAHOTABOP/e7b6d25a9fb9115ddd20822d420e97b9 to your computer and use it in GitHub Desktop.
import base64
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
private_key = X25519PrivateKey.generate()
public_key = private_key.public_key()
def base64it(the_key):
return base64.urlsafe_b64encode(the_key).decode().rstrip("=")
print("private: ", base64it(private_key.private_bytes_raw()))
print("public: ", base64it(public_key.public_bytes_raw()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment