summaryrefslogtreecommitdiff
path: root/tools/fetchacert.py
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-03-31 19:18:30 +0200
committerMagnus Ahltorp <map@kth.se>2015-03-31 19:18:30 +0200
commitab924f51f254d1bdd6f752f8c19c4cbcc55cf0e4 (patch)
tree91261dcf3047c735207d706862bd9136f003230a /tools/fetchacert.py
parenta706e79fa722f681320fe1b05824352b6b9a63fc (diff)
parent13c3789add4f1630c4bc8dfccb229ebc7d4bfa38 (diff)
Merge branch 'genauthkeys'
Diffstat (limited to 'tools/fetchacert.py')
-rwxr-xr-xtools/fetchacert.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/fetchacert.py b/tools/fetchacert.py
new file mode 100755
index 0000000..82ea7c1
--- /dev/null
+++ b/tools/fetchacert.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import argparse
+import base64
+from certtools import *
+
+parser = argparse.ArgumentParser(description='')
+parser.add_argument('baseurl', help="Base URL for CT server")
+parser.add_argument('index', type=int, help="Index for entry to fetch")
+args = parser.parse_args()
+
+rawentries = get_entries(args.baseurl, args.index, args.index)["entries"]
+entry = extract_original_entry(rawentries[0])
+(chain, _timestamp, _issuer_key_hash) = entry
+s = ""
+for cert in chain:
+ s += "-----BEGIN CERTIFICATE-----\n"
+ s += base64.encodestring(cert).rstrip() + "\n"
+ s += "-----END CERTIFICATE-----\n"
+ s += "\n"
+print s