blob: 82ea7c1844716e707f872d6c9db327b6c4013e6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
|