From c308b5eee38c58e122f6eebcca575ed6734bb3b7 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sun, 27 Sep 2015 11:40:47 +0200 Subject: make tests work(s) --- tools/submitcert.py | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'tools/submitcert.py') diff --git a/tools/submitcert.py b/tools/submitcert.py index 3b14912..91d2111 100755 --- a/tools/submitcert.py +++ b/tools/submitcert.py @@ -49,31 +49,14 @@ else: sth = get_sth(baseurl) -def submitcert((certfile, cert)): +def submitcert((certfile, blob)): timing = timing_point() - certchain = get_certs_from_string(cert) - precerts = get_precerts_from_string(cert) - assert len(precerts) == 0 or len(precerts) == 1 - precert = precerts[0] if precerts else None timing_point(timing, "readcerts") try: - if precert: - if ext_key_usage_precert_signing_cert in get_ext_key_usage(certchain[0]): - issuer_key_hash = get_cert_key_hash(certchain[1]) - issuer = certchain[1] - else: - issuer_key_hash = get_cert_key_hash(certchain[0]) - issuer = None - cleanedcert = cleanprecert(precert, issuer=issuer) - signed_entry = pack_precert(cleanedcert, issuer_key_hash) - leafcert = cleanedcert - result = add_prechain(baseurl, {"chain":map(base64.b64encode, [precert] + certchain)}) - else: - signed_entry = pack_cert(certchain[0]) - leafcert = certchain[0] - issuer_key_hash = None - result = add_chain(baseurl, {"chain":map(base64.b64encode, certchain)}) + signed_entry = pack_cert(blob) + issuer_key_hash = None + result = add_chain(baseurl, {"blob":base64.b64encode(blob)}) except SystemExit: print "EXIT:", certfile select.select([], [], [], 1.0) @@ -87,7 +70,7 @@ def submitcert((certfile, cert)): try: if args.check_sct: - check_sct_signature(baseurl, signed_entry, result, precert=precert, publickey=logpublickey) + check_sct_signature(baseurl, signed_entry, result, publickey=logpublickey) timing_point(timing, "checksig") except AssertionError, e: print "ERROR:", certfile, e @@ -101,7 +84,7 @@ def submitcert((certfile, cert)): if lookup_in_log: - merkle_tree_leaf = pack_mtl(result["timestamp"], leafcert) + merkle_tree_leaf = pack_mtl(result["timestamp"], blob) leaf_hash = get_leaf_hash(merkle_tree_leaf) @@ -139,7 +122,7 @@ def submitcert((certfile, cert)): print "and submitted chain has length", len(submittedcertchain) timing_point(timing, "lookup") - return ((leafcert, issuer_key_hash, result), timing["deltatimes"]) + return ((blob, issuer_key_hash, result), timing["deltatimes"]) def get_ncerts(certfiles): n = 0 -- cgit v1.1