CertificateFactory X.509 not found
843811Dec 27 2001 — edited Jan 2 2002I've added logic to my application to use certificates. When I logon, I am asked for a certificate, I select one and then continue on to my application.
The logic uses this code I got from someone else on the project.
weblogic.security.X509 certChain [] =
(weblogic.security.X509 []) request.getAttribute("javax.net.ssl.peer_certificates" );
ByteArrayOutputStream bos;
ByteArrayInputStream bis = null;
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
try {
bos = new ByteArrayOutputStream();
certChain[0].output(bos);
bis = new ByteArrayInputStream(bos.toByteArray());
myCertificate = (X509Certificate)certFactory.generateCertificate(bis);
extractCertificateSubject(myCertificate);
} catch (IOException e) {
throw new CertificateException();
}
The first time this code executes, the CertificateFactory.getInstance("X.509") works fine.
After I logoff and try to logon again, (whether or not I close my browser first), I am not prompted for a certificate but instead get this exception:
java.security.cert.CertificateException: X.509 not found
at java.security.cert.CertificateFactory.getInstance(CertificateFactory.
java:176)
What would cause this exception to occur even though I have successfully executed the getInstance before?
I am running WebLogic 5.1