def create_temporary_ca_file(anchor_list):
"""
Concatenate all the certificates (PEM format for the export) in
'anchor_list' and write the result to file to a temporary file
using mkstemp() from tempfile module. On success 'filename' is
returned, None otherwise.
If you are used to OpenSSL tools, this function builds a CAfile
that can be used for certificate and CRL check.
Also see create_temporary_ca_file().
"""
try:
f, fname = tempfile.mkstemp()
for a in anchor_list:
s = a.output(fmt="PEM")
l = os.write(f, s)
os.close(f)
except:
return None
return fname
评论列表
文章目录