Keep maps of wxTreeListItem to Cinema/Screen.
[dcpomatic.git] / hacks / get_certs_from_config
1 #!/usr/bin/python3
2
3 import os
4 import sys
5
6 import bs4
7
8 with open(sys.argv[1]) as file:
9     xml = file.read()
10
11 soup = bs4.BeautifulSoup(xml, 'xml')
12 for purpose, purpose_name in zip([soup.Signer, soup.Decryption], ['signer', 'decrypt']):
13     for cert, cert_name in zip(purpose.findAll('Certificate'), ['root', 'inter', 'leaf']):
14         name = f"{purpose_name}_{cert_name}"
15         with open(f"{name}.pem", "w") as out:
16             print(cert.text, file=out)
17         os.system(f"openssl x509 -text -in {name}.pem > {name}.dump")
18         os.system(f"openssl asn1parse < {name}.pem > {name}.asn1")
19
20