summaryrefslogtreecommitdiff
path: root/tools/submitcert.py
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2016-03-27 19:27:30 +0200
committerLinus Nordberg <linus@nordu.net>2016-03-27 19:44:25 +0200
commit56d70baa79ae5907b11445364bbea9b31ee4cd20 (patch)
treeef0403255a04de75736da82385d282a0198c52c2 /tools/submitcert.py
parent9f723f6f1d79c1be460ece10555945346045b175 (diff)
WIP
Diffstat (limited to 'tools/submitcert.py')
-rwxr-xr-xtools/submitcert.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/tools/submitcert.py b/tools/submitcert.py
index 91d2111..b185a62 100755
--- a/tools/submitcert.py
+++ b/tools/submitcert.py
@@ -42,7 +42,9 @@ logpublickey = get_public_key_from_file(args.publickey) if args.publickey else N
lookup_in_log = False
-if certfilepath[-1] == "/":
+if certfilepath is None:
+ certfiles = None
+elif certfilepath[-1] == "/":
certfiles = [certfilepath + filename for filename in sorted(os.listdir(certfilepath)) if os.path.isfile(certfilepath + filename)]
else:
certfiles = [certfilepath]
@@ -159,12 +161,17 @@ p = Pool(args.parallel, lambda: signal.signal(signal.SIGINT, signal.SIG_IGN))
nsubmitted = 0
lastprinted = 0
-print "listing certs"
-ncerts = get_ncerts(certfiles)
-
-print ncerts, "certs"
+def get_cert_from_stdin():
+ yield (('<stdin>', base64.b64encode(sys.stdin.read())))
-certs = get_all_certificates(certfiles)
+print "listing certs"
+if certfiles is not None:
+ ncerts = get_ncerts(certfiles)
+ print ncerts, "certs"
+ certs = get_all_certificates(certfiles)
+else:
+ ncerts = 1
+ certs = get_cert_from_stdin()
(result, timing) = submitcert(certs.next())
if result != None: