MCPcopy Index your code
hub / github.com/python/cpython / make_ca

Function make_ca

Lib/test/certdata/make_ssl_certs.py:180–222  ·  view source on GitHub ↗
(cmdlineargs)

Source from the content-addressed store, hash-verified

178 shutil.rmtree(TMP_CADIR)
179
180def make_ca(cmdlineargs):
181 os.mkdir(TMP_CADIR)
182 with open(os.path.join('cadir','index.txt'),'a+') as f:
183 pass # empty file
184 with open(os.path.join('cadir','crl.txt'),'a+') as f:
185 f.write("00")
186 with open(os.path.join('cadir','index.txt.attr'),'w+') as f:
187 f.write('unique_subject = no')
188 # random start value for serial numbers
189 with open(os.path.join('cadir','serial'), 'w') as f:
190 f.write('CB2D80995A69525B\n')
191
192 with tempfile.NamedTemporaryFile("w") as t:
193 req = req_template.format(
194 hostname='our-ca-server',
195 extra_san='',
196 startdate=startdate,
197 enddate=cmdlineargs.enddate,
198 days=cmdlineargs.days
199 )
200 t.write(req)
201 t.flush()
202 with tempfile.NamedTemporaryFile() as f:
203 args = ['req', '-config', t.name, '-new',
204 '-nodes',
205 '-newkey', 'rsa:3072',
206 '-keyout', 'pycakey.pem',
207 '-out', f.name,
208 '-subj', '/C=XY/L=Castle Anthrax/O=Python Software Foundation CA/CN=our-ca-server']
209 check_call(['openssl'] + args)
210 args = ['ca', '-config', t.name,
211 '-out', 'pycacert.pem', '-batch', '-outdir', TMP_CADIR,
212 '-keyfile', 'pycakey.pem',
213 '-selfsign', '-extensions', 'v3_ca', '-infiles', f.name ]
214 check_call(['openssl'] + args)
215 args = ['ca', '-config', t.name, '-gencrl', '-out', 'revocation.crl']
216 check_call(['openssl'] + args)
217
218 # capath hashes depend on subject!
219 check_call([
220 'openssl', 'x509', '-in', 'pycacert.pem', '-out', 'capath/ceff1710.0'
221 ])
222 shutil.copy('capath/ceff1710.0', 'capath/b1930218.0')
223
224
225def write_cert_reference(path):

Callers 1

make_ssl_certs.pyFile · 0.85

Calls 8

check_callFunction · 0.85
openFunction · 0.50
mkdirMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45
formatMethod · 0.45
flushMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…