summaryrefslogtreecommitdiff
path: root/tools/submitcert.py
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2014-09-24 01:14:19 +0200
committerLinus Nordberg <linus@nordberg.se>2014-09-24 13:18:18 +0200
commitd0c0ab627445f1dcb8eb3dcdb7c6bda3809a088d (patch)
treeaa485dd9fa84857cb8bd56e6e46976492f70910e /tools/submitcert.py
parent8904fb9e379aacfff6adcd3001aad3427b9a5fe7 (diff)
submitcert.py: Get submitted entry from log and compare
Diffstat (limited to 'tools/submitcert.py')
-rwxr-xr-xtools/submitcert.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/submitcert.py b/tools/submitcert.py
index 229d36c..7844dda 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,20 @@ 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]