def newca(self, basedir='.'):
        # Based on the CA script from openssl
        rootdir = os.path.join(basedir, 'demoCA')
        self.mkdir(rootdir)
        for dir in ('certs', 'crl', 'newcerts', 'private'):
            self.mkdir(os.path.join(rootdir, dir))
        # write '00' to serial file
        with open(os.path.join(rootdir, 'serial'), 'wb') as f:
            f.write('00')
        # touch index file
        open(os.path.join(rootdir, 'index.txt'), 'w').close()
        # It would be nice to configure the default values and the set
        # of values requested.
        subprocess.call(['openssl', 'req', '-new', '-keyout',
                         os.path.join(rootdir, 'private', 'cakey.pem'),
                         '-out', os.path.join(rootdir, 'careq.pem')])
        subprocess.call(['openssl', 'ca', '-out', 
                         os.path.join(rootdir, 'cacert.pem'),
                         '-days', '1095', # 3 years
                         '-batch', '-keyfile',
                         os.path.join(rootdir, 'private', 'cakey.pem'),
                         '-selfsign', '-infiles', 
                         os.path.join(rootdir, 'careq.pem')])
Create a new CA directory structure starting at rootdir.
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/geni/ca.py/CertificateAuthority.newca