diff options
author | Magnus Ahltorp <map@kth.se> | 2015-02-09 17:23:13 +0100 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-02-09 17:23:13 +0100 |
commit | f2222868f5fc4c3d962048ff3f4bc39fa2d9b64c (patch) | |
tree | b6bd4ec0303f450fffcd908cc09754ada9d1c8a5 /tools/certtools.py | |
parent | 20a4a3357fcf14706e39b8c3f29af05618613f04 (diff) |
submitcert.py: handle .zip files
Diffstat (limited to 'tools/certtools.py')
-rw-r--r-- | tools/certtools.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/certtools.py b/tools/certtools.py index f6c1cd9..428d623 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -11,6 +11,7 @@ import sys import hashlib import ecdsa import datetime +import cStringIO publickeys = { "https://ct.googleapis.com/pilot/": @@ -44,11 +45,14 @@ def get_cert_info(s): def get_pemlike(filename, marker): + return get_pemlike_from_file(open(filename), marker) + +def get_pemlike_from_file(f, marker): entries = [] entry = "" inentry = False - for line in open(filename): + for line in f: line = line.strip() if line == "-----BEGIN " + marker + "-----": entry = "" @@ -63,6 +67,10 @@ def get_pemlike(filename, marker): def get_certs_from_file(certfile): return get_pemlike(certfile, "CERTIFICATE") +def get_certs_from_string(s): + f = cStringIO.StringIO(s) + return get_pemlike_from_file(f, "CERTIFICATE") + def get_eckey_from_file(keyfile): keys = get_pemlike(keyfile, "EC PRIVATE KEY") assert len(keys) == 1 |