Skip to content

Commit

Permalink
style: format code with Autopep8, Black, ClangFormat, dotnet-format, …
Browse files Browse the repository at this point in the history
…Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf

This commit fixes the style issues introduced in b33548e according to the output
from 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.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Jul 20, 2024
1 parent b33548e commit 28d7edc
Showing 1 changed file with 10 additions and 9 deletions.
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()

0 comments on commit 28d7edc

Please sign in to comment.