diff options
Diffstat (limited to 'monitor/josef_mover.py')
| -rwxr-xr-x | monitor/josef_mover.py | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/monitor/josef_mover.py b/monitor/josef_mover.py index 5fb22da..bc7f4a0 100755 --- a/monitor/josef_mover.py +++ b/monitor/josef_mover.py @@ -7,6 +7,7 @@ import datetime import os import json +from precerttools import cleanprecert from monitor_conf import * from josef_lib import * @@ -14,7 +15,8 @@ def print_reply(rep, entry, precert): t = datetime.datetime.fromtimestamp(rep['timestamp'] / 1000, UTC()).strftime("%Y-%m-%d %H:%M:%S") log_id = rep["id"] - # print res + # print json.dumps(rep) + # print entry print "Time:", t @@ -27,17 +29,30 @@ def print_reply(rep, entry, precert): print "Log:", l["name"] - # check_sct_signature(log["url"], entry, rep, precert, log["key"]) + if precert: + print "Type: Precert" + print base64.b64encode(entry[2]) + signed_entry = pack_precert(cleanprecert(entry[0][0]), entry[2]) + else: + print "Type: Cert" + signed_entry = pack_cert(entry[0][0]) + + key = base64.b64decode(log["key"]) - # print "Signature: CHECKING NOT IMPLEMENTED YET!" - # print "" + # try: + check_sct_signature(log["url"], signed_entry, rep, precert, key) + print "Signature: OK" + # except: + # print "Could not verify signature!" + print "" -source = ctlogs[0] -dests = [ctlogs[1]] -first = 153357 -last = 154357 +source = ctlogs[1] +dests = [ctlogs[0]] + +first = 153363 +last = 153365 entries = get_entries(source["url"], first, last)["entries"] @@ -46,7 +61,9 @@ entries = get_entries(source["url"], first, last)["entries"] for log in dests: for item in entries: try: + # print item entry = extract_original_entry(item) + # print entry[2] if entry[2]: precert = True else: @@ -60,13 +77,14 @@ for log in dests: res = add_prechain(log["url"], {"chain" : submission}) else: res = add_chain(log["url"], {"chain" : submission}) - + print res + # print submission print_reply(res, entry, precert) - time.sleep(5) + # time.sleep(5) except KeyboardInterrupt: break - except: - print "FAILED!" + # except: + # print "FAILED!" |
