Merge pull request #7 from mhavrlent/master

added SAN extension
master
Miroslav Havrlent 2017-06-19 22:20:22 +02:00 committed by GitHub
commit da06c097fb
3 changed files with 7 additions and 1 deletions

8
CertTool.py Normal file → Executable file
View File

@ -77,9 +77,15 @@ def dummy_cert(cafile, certfile, commonname):
cert.gmtime_adj_notBefore(0)
cert.gmtime_adj_notAfter(60 * 60 * 24 * 3652)
cert.set_issuer(ca.get_subject())
cert.get_subject().CN = '*' + commonname if commonname.startswith('.') else commonname
if commonname.startswith('.'):
domain = '*' + commonname
else:
domain = commonname
cert.get_subject().CN = domain
cert.set_serial_number(int(time.time()*10000))
cert.set_pubkey(ca.get_pubkey())
cert.add_extensions(
[OpenSSL.crypto.X509Extension(b"subjectAltName", False, str.encode("DNS:"+domain))])
cert.sign(key, "sha256")
with open(certfile, 'wb') as fp:
fp.write(OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, cert))

0
ProxHTTPSProxy.py Normal file → Executable file
View File

0
ProxyTool.py Normal file → Executable file
View File