cert = certGen.generateX509Certificate(privKey);
cert.checkValidity(new Date());
cert.verify(pubKey);
ByteArrayInputStream sbIn = new ByteArrayInputStream(cert.getEncoded());
ASN1InputStream sdIn = new ASN1InputStream(sbIn);
ByteArrayInputStream bIn = new ByteArrayInputStream(cert.getEncoded());
CertificateFactory certFact = CertificateFactory.getInstance("X.509", "BC");