Skip to content

Commit

Permalink
Bugfix CA is verified for all usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
blindlf committed Aug 19, 2015
1 parent 7d93d19 commit e315164
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions gae_proxy/local/cert_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,18 @@ def create_ca():
req.set_pubkey(key)
req.sign(key, CertUtil.ca_digest)
ca = OpenSSL.crypto.X509()
ca.set_version(2)
ca.set_serial_number(0)
ca.gmtime_adj_notBefore(0)
ca.gmtime_adj_notAfter(24 * 60 * 60 * 3652)
ca.set_issuer(req.get_subject())
ca.set_subject(req.get_subject())
ca.set_pubkey(req.get_pubkey())
ca.add_extensions([
OpenSSL.crypto.X509Extension(
'basicConstraints', False, 'CA:TRUE', ca, ca)
])
ca.sign(key, CertUtil.ca_digest)
v3 = OpenSSL.crypto.X509Extension('basicConstraints', False, 'CA:TRUE')
ca.add_extensions([v3])
#logging.debug("CA key:%s", key)
xlog.info("create ca")
return key, ca
Expand Down
7 changes: 5 additions & 2 deletions php_proxy/local/cert_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,18 @@ def create_ca():
req.set_pubkey(key)
req.sign(key, CertUtil.ca_digest)
ca = OpenSSL.crypto.X509()
ca.set_version(2)
ca.set_serial_number(0)
ca.gmtime_adj_notBefore(0)
ca.gmtime_adj_notAfter(24 * 60 * 60 * 3652)
ca.set_issuer(req.get_subject())
ca.set_subject(req.get_subject())
ca.set_pubkey(req.get_pubkey())
ca.add_extensions([
OpenSSL.crypto.X509Extension(
'basicConstraints', False, 'CA:TRUE', ca, ca)
])
ca.sign(key, CertUtil.ca_digest)
v3 = OpenSSL.crypto.X509Extension('basicConstraints', False, 'CA:TRUE')
ca.add_extensions([v3])
return key, ca

@staticmethod
Expand Down

0 comments on commit e315164

Please sign in to comment.