I need to call a restapi which requires SSL certificate which i have installed on WebSphere. Now when i hit the API it gives me an error of 401 not authenticated. Using SSL Certificate i am able to call using PostMan By Attaching Client Certificate and attaching passphrase and private key reference
SSLContext sslctx = SSLContext.getInstance("TLS");
TrustManager[ ] trustcertmgr = getCerticateTrustManager();
sslctx.init(null, // key manager
trustcertmgr, // trust manager
new SecureRandom()); // random number generator
HttpsURLConnection.setDefaultSSLSocketFactory(sslctx.getSocketFactory());
url = new URL(clienturl);
HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
con.setHostnameVerifier(new HostnameVerifier() {
public boolean verify(String host, SSLSession sess)
{
return false;
}});
System.err.println("Connection Created with URL:" + clienturl);