diff options
author | Linus Nordberg <linus@nordu.net> | 2016-12-02 23:44:45 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-12-02 23:44:45 +0100 |
commit | 4b5ddbae54d46bacc23661960b436ecd4f720026 (patch) | |
tree | b79041cd0e3823687a8f7def89d648b36a8ada32 /tools/certtools.py | |
parent | e298a8d12ea6f205330031beb6d572aad9d27ee7 (diff) |
Add initlog.py.
Diffstat (limited to 'tools/certtools.py')
-rw-r--r-- | tools/certtools.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/certtools.py b/tools/certtools.py index e9ee99b..a054bbb 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -16,6 +16,7 @@ import zipfile import shutil import requests import warnings +import logging from datetime import datetime from certkeys import publickeys @@ -753,3 +754,21 @@ def write_file(fn, jsondata): tempname = fn + ".new" open(tempname, 'w').write(json.dumps(jsondata)) mv_file(tempname, fn) + +def generate_tree_head_signature(signingnodes, own_key, + tree_size, timestamp, root_hash): + tree_head_signature = None + for signingnode in signingnodes: + try: + tree_head_signature = \ + create_sth_signature(tree_size, timestamp, + root_hash, + "https://%s/" % signingnode["address"], + key=own_key) + break + except requests.exceptions.HTTPError, e: + logging.warning("create_sth_signature error: %s", e.response) + if tree_head_signature == None: + logging.error("Could not contact any signing nodes") + + return tree_head_signature |