diff options
author | Magnus Ahltorp <map@kth.se> | 2014-09-24 01:14:19 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2014-09-24 01:14:19 +0200 |
commit | d8ae32fbd31b1f2239cc22b6a0cd0098329a0fa7 (patch) | |
tree | a5da67a39fc5c890e8a2687a0b3dc7de64f13ef8 /tools/submitcert.py | |
parent | 8904fb9e379aacfff6adcd3001aad3427b9a5fe7 (diff) |
submitcert.py: Get submitted entry from log and compare
Diffstat (limited to 'tools/submitcert.py')
-rwxr-xr-x | tools/submitcert.py | 18 |
1 files changed, 18 insertions, 0 deletions
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] |