X509Extension kuext = new X509Extension(false, new DEROctetString(value));
values.add(kuext);
oids.add(X509Extensions.KeyUsage);
myCertTemplate.setExtensions(new X509Extensions(oids, values));
CertRequest myCertRequest = new CertRequest(new DERInteger(4), myCertTemplate);
CertReqMsg myCertReqMsg = new CertReqMsg(myCertRequest);
ProofOfPossession myProofOfPossession = new ProofOfPossession(new DERNull(), 0);
myCertReqMsg.setPop(myProofOfPossession);
AttributeTypeAndValue av = new AttributeTypeAndValue(CRMFObjectIdentifiers.regCtrl_regToken, new DERUTF8String("foo123"));
myCertReqMsg.addRegInfo(av);
CertReqMessages myCertReqMessages = new CertReqMessages(myCertReqMsg);
PKIHeader myPKIHeader = new PKIHeader(new DERInteger(2), new GeneralName(new X509Name("CN=bogusSubject")), new GeneralName(new X509Name("CN=bogusIssuer")));
myPKIHeader.setMessageTime(new DERGeneralizedTime(new Date()));
myPKIHeader.setSenderNonce(new DEROctetString(CmpMessageHelper.createSenderNonce()));
myPKIHeader.setTransactionID(new DEROctetString(CmpMessageHelper.createSenderNonce()));