Files
crypto-tools/creatersa.py
T
2026-10-08 21:31:10 +02:00

18 lines
451 B
Python

from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
private_key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048
)
unencrypted_pem_private_key = private_key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.PKCS8
,encryption_algorithm=serialization.NoEncryption()
)
unencrypted_pem_private_key.splitlines()[0]