Created
February 4, 2026 18:57
-
-
Save Sn0wo2/921f49acf8cb0a229e9cb9d19cdadf68 to your computer and use it in GitHub Desktop.
Masque key
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 characters
| import base64 | |
| from cryptography.hazmat.primitives import serialization | |
| from cryptography.hazmat.primitives.asymmetric import ec | |
| private_key = ec.generate_private_key(ec.SECP256R1()) | |
| private_bytes = private_key.private_bytes( | |
| encoding=serialization.Encoding.DER, | |
| format=serialization.PrivateFormat.TraditionalOpenSSL, | |
| encryption_algorithm=serialization.NoEncryption() | |
| ) | |
| private_key_b64 = base64.b64encode(private_bytes).decode('utf-8') | |
| public_key = private_key.public_key() | |
| public_bytes = public_key.public_bytes( | |
| encoding=serialization.Encoding.DER, | |
| format=serialization.PublicFormat.SubjectPublicKeyInfo | |
| ) | |
| public_key_b64 = base64.b64encode(public_bytes).decode('utf-8') | |
| print("=== Private Key ===") | |
| print(private_key_b64) | |
| print("\n=== Public Key ===") | |
| print(public_key_b64) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment