code styling

This commit is contained in:
Oscar Krause
2022-12-28 11:53:56 +01:00
parent c83130f138
commit 92fe6154e6
2 changed files with 30 additions and 37 deletions

17
app/util.py Normal file
View File

@@ -0,0 +1,17 @@
try:
# Crypto | Cryptodome on Debian
from Crypto.PublicKey import RSA
from Crypto.PublicKey.RSA import RsaKey
except ModuleNotFoundError:
from Cryptodome.PublicKey import RSA
from Cryptodome.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)