summaryrefslogtreecommitdiff
path: root/tools/submitcert.py
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2015-09-27 11:40:47 +0200
committerLinus Nordberg <linus@nordu.net>2015-11-20 10:14:15 +0100
commitc308b5eee38c58e122f6eebcca575ed6734bb3b7 (patch)
tree114974089bcf05de29d5d30141bcab9fa2ba834a /tools/submitcert.py
parentb87783cc3dc39d5b2aa1c170cf5afaefc289c85a (diff)
make tests work(s)
Diffstat (limited to 'tools/submitcert.py')
-rwxr-xr-xtools/submitcert.py31
1 files changed, 7 insertions, 24 deletions
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