// Issuer info
v3certGen.setIssuer(caName);
// serial number
v3certGen.setSerialNumber(new DERInteger(serialNum));
// validity
v3certGen.setStartDate(new Time(validFromDate));
v3certGen.setEndDate(new Time(validToDate));
// signature algorithm
v3certGen.setSignature(algId);
// Get the certificate info to be signed
TBSCertificateStructure tbsCert = v3certGen.generateTBSCertificate();