From 28d7edcc9e01c753b6cb10b68eef797baa5cd565 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 20 Jul 2024 15:54:32 +0000 Subject: [PATCH] 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 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 --- quantum-crypto-module/gen_keys.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/quantum-crypto-module/gen_keys.py b/quantum-crypto-module/gen_keys.py index a692cc780..445c2903f 100644 --- a/quantum-crypto-module/gen_keys.py +++ b/quantum-crypto-module/gen_keys.py @@ -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()