diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-02-10 20:47:58 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-02-10 20:47:58 +0100 |
| commit | 869e70cf34ac7f8e6b567bda17db3a72aa61142b (patch) | |
| tree | f5403fb14c5d09f2e3ed6ece1fa12dee10aaf0a9 | |
| parent | 7b6ea0d9d4efd51685529461466218d4dec65ac8 (diff) | |
Add script to get certs out of a config.xml.
| -rwxr-xr-x | hacks/get_certs_from_config | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/hacks/get_certs_from_config b/hacks/get_certs_from_config new file mode 100755 index 000000000..0687e944d --- /dev/null +++ b/hacks/get_certs_from_config @@ -0,0 +1,20 @@ +#!/usr/bin/python3 + +import os +import sys + +import bs4 + +with open(sys.argv[1]) as file: + xml = file.read() + +soup = bs4.BeautifulSoup(xml, 'xml') +for purpose, purpose_name in zip([soup.Signer, soup.Decryption], ['signer', 'decrypt']): + for cert, cert_name in zip(purpose.findAll('Certificate'), ['root', 'inter', 'leaf']): + name = f"{purpose_name}_{cert_name}" + with open(f"{name}.pem", "w") as out: + print(cert.text, file=out) + os.system(f"openssl x509 -text -in {name}.pem > {name}.dump") + os.system(f"openssl asn1parse < {name}.pem > {name}.asn1") + + |
