

def checkRootCA(self):
    keyFile = (self.info.caPathPrefix + '.key')
    crtFile = (self.info.caPathPrefix + '.crt')
    pemFile = (self.info.caPathPrefix + '.pem')
    dirName = os.path.dirname(self.info.caPathPrefix)
    if (not os.path.exists(dirName)):
        os.mkdir(dirName)
    if ((not os.path.isfile(keyFile)) and (not os.path.isfile(crtFile))):
        security = CertSec(DEFAULT_CA_NAME)
        subject = CertSubj(security.fqdn)
        signer = CertSign(None, security.certKey, subject.getSubject())
        cert = Certificate(self.info.caPathPrefix, signer, security)
        cert.addExtension(BasicConstraint(True))
        cert.security.build()
        cert.signer.build()
        cert.build()
        cert.writeKey(keyPassword=self.info.caPassword)
    elif ((not os.path.isfile(keyFile)) or (not os.path.isfile(crtFile))):
        raise Exception(('Missing %s or %s' % (keyFile, crtFile)))
    if (not os.path.isfile(pemFile)):
        shutil.copy(crtFile, pemFile)

dataset/ETHPy150Open yymax/x509test/src/TestSet.py TestSet.checkRootCA/original