diff options
Diffstat (limited to 'tools/submitcert.py')
-rwxr-xr-x | tools/submitcert.py | 19 |
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] |