g5k
This commit is contained in:
parent
08fd52eedb
commit
752055866f
4 changed files with 75 additions and 6 deletions
13
makecerts.py
Normal file
13
makecerts.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue