migrated api to database-config (Site, Instance)

This commit is contained in:
Oscar Krause
2023-06-12 15:19:06 +02:00
parent 18807401e4
commit 39a2408d8d
3 changed files with 138 additions and 62 deletions

View File

@@ -16,6 +16,18 @@ def load_key(filename) -> "RsaKey":
return RSA.import_key(extern_key=load_file(filename), passphrase=None)
def parse_key(content: bytes) -> "RsaKey":
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
return RSA.import_key(extern_key=content, passphrase=None)
def generate_key() -> "RsaKey":
try:
# Crypto | Cryptodome on Debian