From d8ae32fbd31b1f2239cc22b6a0cd0098329a0fa7 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Wed, 24 Sep 2014 01:14:19 +0200 Subject: submitcert.py: Get submitted entry from log and compare --- tools/submitcert.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tools/submitcert.py') diff --git a/tools/submitcert.py b/tools/submitcert.py index 229d36c..7471272 100755 --- a/tools/submitcert.py +++ b/tools/submitcert.py @@ -36,6 +36,8 @@ if lookup_in_log: leaf_type = struct.pack(">b", 0) merkle_tree_leaf = version + leaf_type + timestamped_entry + print "merkle_tree_leaf:", base64.b64encode(merkle_tree_leaf) + leaf_hash = hashlib.sha256() leaf_hash.update(struct.pack(">b", 0)) leaf_hash.update(merkle_tree_leaf) @@ -48,3 +50,19 @@ if lookup_in_log: proof = get_proof_by_hash(baseurl, leaf_hash.digest(), sth["tree_size"]) print proof + + leaf_index = proof["leaf_index"] + + entries = get_entries(baseurl, leaf_index, leaf_index) + + fetched_entry = entries["entries"][0] + + print fetched_entry + + print "does the leaf_input of the fetched entry match what we calculated:", base64.decodestring(fetched_entry["leaf_input"]) == merkle_tree_leaf + + extra_data = fetched_entry["extra_data"] + + certchain = decode_certificate_chain(base64.decodestring(extra_data)) + + print [base64.b64encode(cert) for cert in certchain] -- cgit v1.1