mirror of
https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
synced 2025-11-04 16:36:11 +00:00
code styling
This commit is contained in:
17
app/util.py
Normal file
17
app/util.py
Normal 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)
|
||||
Reference in New Issue
Block a user