Skip to content

Commit

Permalink
added SAN extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Miroslav Havrlent committed Jun 13, 2017
1 parent 0037042 commit 2ef3649
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CertTool.py 100644 → 100755
Expand Up @@ -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))
Expand Down
Empty file modified ProxHTTPSProxy.py 100644 → 100755
Empty file.
Empty file modified ProxyTool.py 100644 → 100755
Empty file.

0 comments on commit 2ef3649

Please sign in to comment.