Skip to content

Commit

Permalink
Create keygen.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 9, 2024
1 parent f39bdd6 commit faabbab
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions projects/pi-nexus-iam/quantum-crypto/keygen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.backends import default_backend

def generate_key_pair():
key = ec.generate_private_key(
ec.SECP256R1(),
default_backend()
)
private_key = key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.TraditionalOpenSSL,
encryption_algorithm=serialization.NoEncryption()
)
public_key = key.public_key().public_bytes(
encoding=serialization.Encoding.OpenSSH,
format=serialization.PublicFormat.OpenSSH
)
return private_key, public_key

0 comments on commit faabbab

Please sign in to comment.