//
// create the certificate - version 3
//
X509V3CertificateGenerator x509V1CertificateGenerator = new X509V3CertificateGenerator();
x509V1CertificateGenerator.addExtension(X509Extensions.BasicConstraints, false, new BasicConstraints(true));
x509V1CertificateGenerator.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis()));
x509V1CertificateGenerator.setIssuerDN(new X509Principal(issuer));
x509V1CertificateGenerator.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
x509V1CertificateGenerator.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 30)));
x509V1CertificateGenerator.setSubjectDN(new X509Principal(subject));