blob: 9df11c2631a159e57e58a63fde6f298752449333 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015, NORDUnet A/S.
# See LICENSE for licensing information.
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
|