Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated  RSS feed

 
Sunil Linga
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am getting below exception while connecting to an URL over SSL using httpclient 3 from our application running on WAS 6 and j2sdk 1.4.

[4/15/11 11:16:15:103 EDT] 00000038 SystemErr Rjavax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at com.ibm.jsse2.bm.getPeerCertificateChain(bm.java:52)
at xxxxxxxx.common.StrictSSLProtocolSocketFactory.verifyHostname(Unknown Source)
at xxxxxxxx.common.StrictSSLProtocolSocketFactory.createSocket(Unknown Source)
at org.apache.commons.httpclient.HttpConnection.tunnelCreated(HttpConnection.java:785)
at org.apache.commons.httpclient.HttpMethodDirector.executeConnect(HttpMethodDirector.java:513)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:390)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(

Strangely, the same piece of code is working fine when ran as a stand alone outside the application.

Below is the code snippet I am using..

StrictSSLProtocolSocketFactory stricthttps = new StrictSSLProtocolSocketFactory(true);
stricthttps.setDN("CN=***, OU=***, OU=***, OU=***, O=***, C=***, SERIALNUMBER=***");
Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory)stricthttps, Integer.parseInt("443")));
HttpClient httpclient = new HttpClient();
httpclient.getHostConfiguration().setProxy(host, port);
httpreq = new PostMethod("https://xxxx.com/contextpath");
StringRequestEntry myString = new StringRequestEntry(message);
httpreq.setRequestEntity(myString);

httpclient.execteMethod(httpreq);

Any help in this is greatly appreciated!

Thanks in advanced!
Sunil.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!