diff options
Diffstat (limited to 'tools/certtools.py')
-rw-r--r-- | tools/certtools.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/certtools.py b/tools/certtools.py index 939d9f1..2c97dfb 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -668,3 +668,13 @@ def verify_inclusion_proof(inclusion_proof, index, treesize, leafhash): assert len(nodes_for_index(index, treesize)) == len(inclusion_proof) (_, hash) = reduce(lambda e1, e2: combine_two_hashes(e1, e2, treesize), chain) return hash + +def extract_original_entry(entry): + leaf_input = base64.decodestring(entry["leaf_input"]) + (leaf_cert, timestamp, issuer_key_hash) = unpack_mtl(leaf_input) + extra_data = base64.decodestring(entry["extra_data"]) + if issuer_key_hash != None: + (precert, extra_data) = extract_precertificate(extra_data) + leaf_cert = precert + certchain = decode_certificate_chain(extra_data) + return ([leaf_cert] + certchain, timestamp, issuer_key_hash) |