Created
May 19, 2022 18:41
-
-
Save msampathkumar/677d424d0872caa58ae39fa3236a02ac to your computer and use it in GitHub Desktop.
Revisions
-
msampathkumar created this gist
May 19, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import base64 from cryptography.hazmat.primitives.asymmetric import ed25519 from cryptography.hazmat.primitives import serialization private_key = ed25519.Ed25519PrivateKey.generate() public_key = private_key.public_key() private_key_str = private_key.private_bytes( encoding=serialization.Encoding.Raw, format=serialization.PrivateFormat.Raw, encryption_algorithm=serialization.NoEncryption()) print("Private Key:\t", base64.urlsafe_b64encode(private_key_str)) public_key_str = public_key.public_bytes( encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw ) print("Public Key:\t", base64.urlsafe_b64encode(public_key_str)) with open('private.key', 'wb') as fp: fp.write(base64.urlsafe_b64encode(private_key_str)) with open('public.pub', 'wb') as fp: fp.write(base64.urlsafe_b64encode(public_key_str))