| OLD | NEW |
| 1 # Copyright 2014 Google Inc. All Rights Reserved. | 1 # Copyright 2014 Google Inc. All Rights Reserved. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 ca_cert.set_serial_number(int(time.time()*10000)) | 123 ca_cert.set_serial_number(int(time.time()*10000)) |
| 124 ca_cert.set_version(2) | 124 ca_cert.set_version(2) |
| 125 ca_cert.get_subject().CN = subject | 125 ca_cert.get_subject().CN = subject |
| 126 ca_cert.get_subject().O = subject | 126 ca_cert.get_subject().O = subject |
| 127 ca_cert.gmtime_adj_notBefore(-60 * 60 * 24 * 365 * 2) | 127 ca_cert.gmtime_adj_notBefore(-60 * 60 * 24 * 365 * 2) |
| 128 ca_cert.gmtime_adj_notAfter(60 * 60 * 24 * 365 * 2) | 128 ca_cert.gmtime_adj_notAfter(60 * 60 * 24 * 365 * 2) |
| 129 ca_cert.set_issuer(ca_cert.get_subject()) | 129 ca_cert.set_issuer(ca_cert.get_subject()) |
| 130 ca_cert.set_pubkey(key) | 130 ca_cert.set_pubkey(key) |
| 131 ca_cert.add_extensions([ | 131 ca_cert.add_extensions([ |
| 132 crypto.X509Extension('basicConstraints', True, 'CA:TRUE'), | 132 crypto.X509Extension('basicConstraints', True, 'CA:TRUE'), |
| 133 crypto.X509Extension('subjectAltName', False, 'DNS:'+subject), | 133 crypto.X509Extension('subjectAltName', False, 'DNS:' + subject), |
| 134 crypto.X509Extension('nsCertType', True, 'sslCA'), | 134 crypto.X509Extension('nsCertType', True, 'sslCA'), |
| 135 crypto.X509Extension('extendedKeyUsage', True, | 135 crypto.X509Extension('extendedKeyUsage', True, |
| 136 ('serverAuth,clientAuth,emailProtection,' | 136 ('serverAuth,clientAuth,emailProtection,' |
| 137 'timeStamping,msCodeInd,msCodeCom,msCTLSign,' | 137 'timeStamping,msCodeInd,msCodeCom,msCTLSign,' |
| 138 'msSGC,msEFS,nsSGC')), | 138 'msSGC,msEFS,nsSGC')), |
| 139 crypto.X509Extension('keyUsage', False, 'keyCertSign, cRLSign'), | 139 crypto.X509Extension('keyUsage', False, 'keyCertSign, cRLSign'), |
| 140 crypto.X509Extension('subjectKeyIdentifier', False, 'hash', | 140 crypto.X509Extension('subjectKeyIdentifier', False, 'hash', |
| 141 subject=ca_cert), | 141 subject=ca_cert), |
| 142 ]) | 142 ]) |
| 143 ca_cert.sign(key, 'sha256') | 143 ca_cert.sign(key, 'sha256') |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 cmd = ['certutil', '--empty-password', '-d', 'sql:' + cert_database_path] | 280 cmd = ['certutil', '--empty-password', '-d', 'sql:' + cert_database_path] |
| 281 cmd.extend(args) | 281 cmd.extend(args) |
| 282 logging.info(subprocess.list2cmdline(cmd)) | 282 logging.info(subprocess.list2cmdline(cmd)) |
| 283 subprocess.check_call(cmd) | 283 subprocess.check_call(cmd) |
| 284 | 284 |
| 285 if not os.path.isdir(cert_database_path): | 285 if not os.path.isdir(cert_database_path): |
| 286 os.makedirs(cert_database_path) | 286 os.makedirs(cert_database_path) |
| 287 certutil(['-N']) | 287 certutil(['-N']) |
| 288 | 288 |
| 289 certutil(['-A', '-t', 'PC,,', '-n', certificate_path, '-i', certificate_path]) | 289 certutil(['-A', '-t', 'PC,,', '-n', certificate_path, '-i', certificate_path]) |
| OLD | NEW |