This commit is contained in:
Pascal Engélibert 2026-01-23 17:20:13 +01:00
commit 752055866f
4 changed files with 75 additions and 6 deletions

13
makecerts.py Normal file
View file

@ -0,0 +1,13 @@
# Get certificates from domains and make a similar chain.
import OpenSSL
import ssl
def get_server_cert(domain, port=443):
cert_pem = ssl.get_server_certificate((domain, port))
cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert_pem)
for i in range(cert.get_extension_count()):
ext = cert.get_extension(i)
ext_name = ext.get_short_name()
if ext_name == "":
return cert