How to use p12 certificate programatically? - Help please!
843811May 15 2008 — edited May 16 2008Hello,
I have a requirement where I need to use a .p12 certificate to access secured HTTP URL.
I did read a forum aritcle where it was suggested to read the private key and client certificate from the p12 certificate and enter the same in JKS store.
But I'm not sure how to accomplish this. It would be nice is someone could post the code snippet for reading the p12 certificate and loading it in JKS keystore format.
Also, I tried importing this p12 certificate in IE and I was able to access my URL. I exported the same as DER encode X.509 certificate. I imported this into a local key store and tried to set my system properties (javax.net.ssl.keyStore) to this key store. When I tried to open a connection to the URL, it gives
the following exception. So I assume the certificate that was exported from IE is not a valid one.
{color:#ff0000}PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
{color}{color:#000000}It would be great if someone could share their advice. This is really urgent please!
Thanks!{color}