diff options
author | Magnus Ahltorp <map@kth.se> | 2015-04-23 16:32:21 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-04-23 16:34:07 +0200 |
commit | 2bd043cb386e3b0fcab28ca2b27e9be21450a72c (patch) | |
tree | 7d37ae3b9c03e9e65b59e665fdfe36bad767c2f4 /tools/verifysecondary.py | |
parent | 8fce884a61fb2ecb626f6df41e214d3dfdbe91fd (diff) |
Add support for merge secondaries
Diffstat (limited to 'tools/verifysecondary.py')
-rwxr-xr-x | tools/verifysecondary.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/verifysecondary.py b/tools/verifysecondary.py new file mode 100755 index 0000000..79a98bf --- /dev/null +++ b/tools/verifysecondary.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2014, NORDUnet A/S. +# See LICENSE for licensing information. + +import argparse +import base64 +import sys +import subprocess +from certtools import build_merkle_tree +from mergetools import * + +parser = argparse.ArgumentParser(description="") +parser.add_argument('--mergedb', help="Merge database", required=True) +parser.add_argument('--verifycert', help="Path to verifycert program", required=True) +parser.add_argument('--knownroots', help="Path to knownroots directory", required=True) +args = parser.parse_args() + +mergedb = args.mergedb +chainsdir = mergedb + "/chains" +logorderfile = mergedb + "/logorder" + +verifycert = subprocess.Popen([args.verifycert, args.knownroots], + stdin=subprocess.PIPE, stdout=subprocess.PIPE) + +logorder = get_logorder(logorderfile) + +for hash in logorder: + entry = read_chain(chainsdir, hash) + verify_entry(verifycert, entry, hash) + +tree = build_merkle_tree(logorder) +root_hash = tree[-1][0] + +print base64.b16encode(root_hash) |