You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Sunil Linga <su...@gmail.com> on 2011/04/15 18:08:49 UTC

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

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     R
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
             at com.ibm.jsse2.bm.getPeerCertificateChain(bm.java:52)
             at
funb.eprofile.common.StrictSSLProtocolSocketFactory.verifyHostname(Unknown
Source)
             at
funb.eprofile.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.
-- 
View this message in context: http://old.nabble.com/javax.net.ssl.SSLPeerUnverifiedException%3A-peer-not-authenticated-tp31407173p31407173.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2011-04-18 at 11:24 +0100, sebb wrote:
> On 15 April 2011 17:08, Sunil Linga <su...@gmail.com> wrote:
> >
> > 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     R
> > javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
> >             at com.ibm.jsse2.bm.getPeerCertificateChain(bm.java:52)
> >             at
> > funb.eprofile.common.StrictSSLProtocolSocketFactory.verifyHostname(Unknown
> > Source)
> >             at
> > funb.eprofile.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!
> 
> StrictSSLProtocolSocketFactory is not a Commons HttpClient class, so
> we cannot help you here.
> 
> I suggest you ask the providers of the class what the error means.
> 

This is a class from HC 3.x contrib package that I wrote a looong time
ago and which is distributed 'as is' without official support by the
project.

The error means incorrect that SSL context configuration is wrong
(certificate sent by the server is not trusted) and has nothing to do
with HTTP or HttpClient.

Oleg   


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

Posted by sebb <se...@gmail.com>.
On 15 April 2011 17:08, Sunil Linga <su...@gmail.com> wrote:
>
> 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     R
> javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
>             at com.ibm.jsse2.bm.getPeerCertificateChain(bm.java:52)
>             at
> funb.eprofile.common.StrictSSLProtocolSocketFactory.verifyHostname(Unknown
> Source)
>             at
> funb.eprofile.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!

StrictSSLProtocolSocketFactory is not a Commons HttpClient class, so
we cannot help you here.

I suggest you ask the providers of the class what the error means.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org