diff options
author | Magnus Ahltorp <map@kth.se> | 2017-02-02 16:08:24 +0100 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2017-02-02 16:08:24 +0100 |
commit | 06a6db0d0dc921527c4667037d7cc9fa000645d5 (patch) | |
tree | 3f4ff97960386e7bf69d36ae6b4d34331495a752 /tools/readconfig.py | |
parent | c9f058c7c7984a4443ca302ace4de85d2e5b18fa (diff) |
Added tools for getting and generating global configkey-management2
Diffstat (limited to 'tools/readconfig.py')
-rw-r--r-- | tools/readconfig.py | 13 |
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) |