Esempio n. 1
0
def buildChain(bits,subjList,**kw):
    out = []
    certainity = kw.pop("certainity",32)
    days = kw.pop("days",1460)
    days_dec = kw.pop("days_dec",1)
    i = 1
    li = len(subjList)
    log = kw.pop("log",NullLogger())
    log.write("Building key %i of %i\n"%(i,li))
    log.flush()
    key = RSAKeyUtils.genRSAPair(bits,certainity)
    subj = subjList[0]
    log.write("Building csr for \"%s\"\n"%subj)
    csr = CsrUtils.newCsr(subj,key,True)
    crt = CertUtils.selfSignCsrCA(csr,key,days)
    serial = bi(2)
    days -= days_dec
    out.append( (key,csr,crt) )
    i += 1
    for subj in subjList[1:]:
        log.write("Building key %i of %i\n"%(i,li))
        log.flush()
        key = RSAKeyUtils.genRSAPair(bits,certainity)
        log.write("Building csr for \"%s\"\n"%subj)
        csr = CsrUtils.newCsr(subj,key,True)
        sigKey = out[-1][0]
        caCrt = out[-1][2]
        crt = CertUtils.signCSR(csr,sigKey,caCrt,days,serial)
        out.append((key,csr,crt))
        i += 1
    return out
Esempio n. 2
0
def newCrt(bits,subj,caKey,caCrt,**kw):
    certainity = kw.pop("certainity",32)
    key = RSAKeyUtils.genRSAPair(bits,certainity)
    csr = CsrUtils.newCsr(subj,key,False)
    crt = CertUtils.signCSR(csr,caKey,caCrt,730,None)
    return (key,csr,crt)