Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf #1535

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions quantum-crypto-module/gen_keys.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
# quantum-crypto-module/gen_keys.py
import os
import hashlib
import os

from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.backends import default_backend


def generate_keys():
# Generate RSA key pair
key = rsa.generate_private_key(
public_exponent=65537,
key_size=4096,
backend=default_backend()
public_exponent=65537, key_size=4096, backend=default_backend()
)

# Serialize private key
private_key_pem = key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.PKCS8,
encryption_algorithm=serialization.NoEncryption()
encryption_algorithm=serialization.NoEncryption(),
)

# Serialize public key
public_key_pem = key.public_key().public_bytes(
encoding=serialization.Encoding.OpenSSH,
format=serialization.PublicFormat.OpenSSH
format=serialization.PublicFormat.OpenSSH,
)

# Save keys to files
with open('private_key.pem', 'wb') as f:
with open("private_key.pem", "wb") as f:
f.write(private_key_pem)

with open('public_key.pem', 'wb') as f:
with open("public_key.pem", "wb") as f:
f.write(public_key_pem)

return private_key_pem, public_key_pem


generate_keys()
Loading