summaryrefslogtreecommitdiff
path: root/tools/certtools.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/certtools.py')
-rw-r--r--tools/certtools.py19
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