From 4b5ddbae54d46bacc23661960b436ecd4f720026 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 2 Dec 2016 23:44:45 +0100 Subject: Add initlog.py. --- tools/certtools.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tools/certtools.py') 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 -- cgit v1.1