diff options
author | Linus Nordberg <linus@nordberg.se> | 2015-03-25 11:00:21 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2015-03-25 11:00:21 +0100 |
commit | 54e0457f1e4c4376bdecc891a2d5ae423eb2266d (patch) | |
tree | 8a756b221ded2625f186ff15b150a99365abe067 /tools/verifysct.py | |
parent | f5ee5ed3e1b445c52efd7978357adf5552643fd4 (diff) | |
parent | 842b07ef461483fcc297cc56e128918ddd273932 (diff) |
Merge remote-tracking branch 'refs/remotes/map/compileconfig2'
Conflicts:
.gitignore
Diffstat (limited to 'tools/verifysct.py')
-rwxr-xr-x | tools/verifysct.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/verifysct.py b/tools/verifysct.py index 699a0ad..27ab4c9 100755 --- a/tools/verifysct.py +++ b/tools/verifysct.py @@ -34,8 +34,16 @@ def verifysct(sctentry): timing = timing_point() leafcert = base64.b64decode(sctentry["leafcert"]) + if "issuer_key_hash" in sctentry: + issuer_key_hash = base64.b64decode(sctentry["issuer_key_hash"]) + else: + issuer_key_hash = None try: - check_sct_signature(baseurl, leafcert, sctentry["sct"]) + if issuer_key_hash: + signed_entry = pack_precert(leafcert, issuer_key_hash) + else: + signed_entry = pack_cert(leafcert) + check_sct_signature(baseurl, signed_entry, sctentry["sct"], precert=issuer_key_hash) timing_point(timing, "checksig") except AssertionError, e: print "ERROR:", e @@ -47,7 +55,10 @@ def verifysct(sctentry): print "ERROR: bad signature" return (None, None) - merkle_tree_leaf = pack_mtl(sctentry["sct"]["timestamp"], leafcert) + if issuer_key_hash: + merkle_tree_leaf = pack_mtl_precert(sctentry["sct"]["timestamp"], leafcert, issuer_key_hash) + else: + merkle_tree_leaf = pack_mtl(sctentry["sct"]["timestamp"], leafcert) leaf_hash = get_leaf_hash(merkle_tree_leaf) @@ -76,7 +87,7 @@ def verifysct(sctentry): p = Pool(args.parallel, lambda: signal.signal(signal.SIGINT, signal.SIG_IGN)) sctfile = open(args.sct_file) -scts = [json.loads(row) for row in sctfile] +scts = (json.loads(row) for row in sctfile) nverified = 0 lastprinted = 0 |