diff options
author | Magnus Ahltorp <map@kth.se> | 2014-10-27 14:37:48 +0100 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2014-10-27 14:37:48 +0100 |
commit | 44f48b0f96aba0009bd43036eea443f07cec71b9 (patch) | |
tree | d419a3ef2d4da2cb8ff025a4f204f84b81c5e3bb /tools/certtools.py | |
parent | 91e5b7f4b85cdbc399ccaa1bb1d813e0d829f3d5 (diff) |
Added fetchallcerts.py
Diffstat (limited to 'tools/certtools.py')
-rw-r--r-- | tools/certtools.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/certtools.py b/tools/certtools.py index 7b901cf..16c2105 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -199,6 +199,14 @@ def pack_mtl(timestamp, leafcert): merkle_tree_leaf = version + leaf_type + timestamped_entry return merkle_tree_leaf +def unpack_mtl(merkle_tree_leaf): + version = merkle_tree_leaf[0:1] + leaf_type = merkle_tree_leaf[1:2] + timestamped_entry = merkle_tree_leaf[2:] + (timestamp, entry_type) = struct.unpack(">QH", timestamped_entry[0:10]) + (leafcert, rest_entry) = unpack_tls_array(timestamped_entry[10:], 3) + return (leafcert, timestamp) + def get_leaf_hash(merkle_tree_leaf): leaf_hash = hashlib.sha256() leaf_hash.update(struct.pack(">b", 0)) |