In firefox, when we select the certificate of the website and click on view certificate, it gives us the option to download PEM cert or PEM cert chain. For my use case, I need to work with java.security.cert.X509Certificate. The code to do this is:
InputStream is = ...//read the PEM cert file
java.security.cert.CertificateFactory cf = java.security.cert.CertificateFactory.getInstance("X.509");
java.security.cert.X509Certificate cert = (java.security.cert.X509Certificate)cf.generateCertificate(is);
Reference:
No comments:
Post a Comment