Esempio n. 1
0
    def setCF(self,api=False,chain=False):
        key  = open(self.keyfile,"r").read()
        cert = open(self.certfile,"r").read()

        if chain:
            chainStr = open(self.chainfile,"r").read()
        else:
            chainStr = ""

        if api:
            zcf = ZeusUtil.getCertFile(key,cert,chainStr)
            for error in zcf.getErrorList():
                printf("%s\n",error)
            cf = CertificateFiles()
            cf.setPublic_cert(zcf.getPublic_cert())
            cf.setPrivate_key(zcf.getPrivate_key())
            self.cf = cf
            return cf
        else:
            zcert = cert + chainStr
            cf = CertificateFiles()
            cf.setPrivate_key(key)
            cf.setPublic_cert(zcert)
            self.cf = cf
            return cf
Esempio n. 2
0
def newCertificateFile(key_file,crt_file):
    pem_key = open(fullPath(key_file),"r").read()
    crt_key = open(fullPath(crt_file),"r").read()
    certFile = CertificateFiles()
    certFile.setPrivate_key(pem_key)
    certFile.setPublic_cert(crt_pem)
    return certFile