Moves load_key_file to Cryptographer and updates pisad to use it

This commit is contained in:
Sergi Delgado Segura
2020-02-01 12:26:02 +01:00
parent 4ea6450c0e
commit ab21cbfc8f
3 changed files with 62 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ from sys import argv, exit
from signal import signal, SIGINT, SIGQUIT, SIGTERM
from common.logger import Logger
from common.cryptographer import Cryptographer
from pisa import config, LOG_PREFIX
from pisa.api import API
@@ -44,8 +45,9 @@ def main():
else:
try:
with open(config.get("PISA_SECRET_KEY"), "rb") as key_file:
secret_key_der = key_file.read()
secret_key_der = Cryptographer.load_key_file(config.get("PISA_SECRET_KEY"))
if not secret_key_der:
raise IOError("PISA private key can't be loaded")
watcher = Watcher(db_manager, Responder(db_manager), secret_key_der, config)