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
#!/usr/bin/env jython

import org.openstack.atlas.util.ca.RSAKeyUtils as RSAKeyUtils
import org.openstack.atlas.util.ca.PemUtils as PemUtils
import org.openstack.atlas.util.ca.CsrUtils as CsrUtils
import org.openstack.atlas.util.ca.CertUtils as CertUtils

kp = RSAKeyUtils.genKeyPair(1024)
x = RSAKeyUtils.toPKCS8(kp)
out = PemUtils.toPemString(x)
Esempio n. 3
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)