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>2016-02-01 11:40:25 +0100
commit162e3c626bedcbb782e2c556279f47bc563236d8 (patch)
treeca6c7b291f9190ada7a1b8400b816786ba7f7d97 /tools/submitcert.py
parent1aa959b65818ca98855d7af1ba610528cc82fc25 (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