diff --git a/app/helper.py b/app/helper.py deleted file mode 100644 index b416ab3..0000000 --- a/app/helper.py +++ /dev/null @@ -1,20 +0,0 @@ -from Crypto.PublicKey import RSA -from Crypto.PublicKey.RSA import RsaKey - - -def load_file(filename) -> bytes: - with open(filename, 'rb') as file: - content = file.read() - return content - - -def load_key(filename) -> RsaKey: - return RSA.import_key(extern_key=load_file(filename), passphrase=None) - - -def private_bytes(rsa: RsaKey) -> bytes: - return rsa.export_key(format='PEM', passphrase=None, protection=None) - - -def public_key(rsa: RsaKey) -> bytes: - return rsa.public_key().export_key(format='PEM') diff --git a/app/main.py b/app/main.py index 42ac2d2..39d3641 100644 --- a/app/main.py +++ b/app/main.py @@ -12,8 +12,19 @@ from calendar import timegm from jose import jws, jwk, jwt from jose.constants import ALGORITHMS from starlette.responses import StreamingResponse, JSONResponse +from Crypto.PublicKey import RSA +from Crypto.PublicKey.RSA import RsaKey + + +def load_file(filename) -> bytes: + with open(filename, 'rb') as file: + content = file.read() + return content + + +def load_key(filename) -> RsaKey: + return RSA.import_key(extern_key=load_file(filename), passphrase=None) -from helper import load_key, private_bytes, public_key # todo: initialize certificate (or should be done by user, and passed through "volumes"?)