diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/verifysct.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/verifysct.py b/tools/verifysct.py index 290d471..699a0ad 100755 --- a/tools/verifysct.py +++ b/tools/verifysct.py @@ -28,6 +28,8 @@ from multiprocessing import Pool baseurl = args.baseurl +sth = get_sth(baseurl) + def verifysct(sctentry): timing = timing_point() @@ -49,16 +51,19 @@ def verifysct(sctentry): leaf_hash = get_leaf_hash(merkle_tree_leaf) - proof = get_proof_by_hash(baseurl, leaf_hash, sctentry["sth"]["tree_size"]) + try: + proof = get_proof_by_hash(baseurl, leaf_hash, sth["tree_size"]) + except SystemExit: + return (None, None) #print proof leaf_index = proof["leaf_index"] inclusion_proof = [base64.b64decode(e) for e in proof["audit_path"]] - calc_root_hash = verify_inclusion_proof(inclusion_proof, leaf_index, sctentry["sth"]["tree_size"], leaf_hash) + calc_root_hash = verify_inclusion_proof(inclusion_proof, leaf_index, sth["tree_size"], leaf_hash) - root_hash = base64.b64decode(sctentry["sth"]["sha256_root_hash"]) + root_hash = base64.b64decode(sth["sha256_root_hash"]) if root_hash != calc_root_hash: print "sth" print base64.b16encode(root_hash) |