summaryrefslogtreecommitdiff
path: root/tools/readconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/readconfig.py')
-rw-r--r--tools/readconfig.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/readconfig.py b/tools/readconfig.py
index 5079691..69531ca 100644
--- a/tools/readconfig.py
+++ b/tools/readconfig.py
@@ -34,10 +34,7 @@ def errorhandlify(term, filename, path=[]):
print "unknown type", type(term)
sys.exit(1)
-def verify_and_read_config(filename, publickey_base64):
- rawconfig = open(filename).read()
- signature = open(filename + ".sig").read()
-
+def verify_config(rawconfig, signature, publickey_base64, filename):
publickey = base64.decodestring(publickey_base64)
try:
@@ -50,5 +47,13 @@ def verify_and_read_config(filename, publickey_base64):
return errorhandlify(yaml.load(io.BytesIO(rawconfig), yaml.SafeLoader), filename)
+def verify_and_read_config(filename, publickey_base64):
+ rawconfig = open(filename).read()
+ signature = open(filename + ".sig").read()
+
+ verify_config(rawconfig, signature, publickey_base64, filename)
+
+ return errorhandlify(yaml.load(io.BytesIO(rawconfig), yaml.SafeLoader), filename)
+
def read_config(filename):
return errorhandlify(yaml.load(open(filename), yaml.SafeLoader), filename)