diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/certtools.py | 7 | ||||
-rwxr-xr-x | tools/check-sth.py | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/tools/certtools.py b/tools/certtools.py index 405aabd..ccbc76e 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -219,7 +219,12 @@ def encode_signature(hash_alg, signature_alg, unpacked_signature): def check_signature(baseurl, signature, data, publickey=None): if publickey == None: - publickey = base64.decodestring(publickeys[baseurl]) + if baseurl in publickeys: + publickey = base64.decodestring(publickeys[baseurl]) + else: + print >>sys.stderr, "Public key for", baseurl, \ + "not found, specify key file with --publickey" + sys.exit(1) (hash_alg, signature_alg, unpacked_signature) = decode_signature(signature) assert hash_alg == 4, \ "hash_alg is %d, expected 4" % (hash_alg,) # sha256 diff --git a/tools/check-sth.py b/tools/check-sth.py index 0cdc031..dacd8e6 100755 --- a/tools/check-sth.py +++ b/tools/check-sth.py @@ -26,8 +26,8 @@ parser.add_argument('--cur-sth', metavar='file', default=DEFAULT_CUR_FILE, help="File containing current STH (default=%s)" % DEFAULT_CUR_FILE) -parser.add_argument('publickey', help='File containing the public key for the CT log') parser.add_argument('baseurl', help="Base URL for CT log") +parser.add_argument('--publickey', default=None, metavar='file', help='Public key for the CT log') parser.add_argument('--cafile', default=None, metavar='file', help='File containing the CA cert') parser.add_argument('--allow-lag', action='store_true', help='Allow node to lag behind previous STH') parser.add_argument('--quiet-ok', action='store_true', help="Don't print status if OK") |