hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khare, Aparna" <aparna.kh...@sap.com>
Subject HttpClient 4.1.3 Peer not verified
Date Thu, 01 Sep 2016 15:45:39 GMT
Hi All,

  I'm using httpclien-4.1.3 and I get the below issue.

I have used trust all mode
Below is the code


    SSLContext sslContext;
    try {
      sslContext = SSLContext.getInstance("SSL");
      TrustManager[] trustAllTrustManagers = new TrustManager[] { new javax.net.ssl.X509TrustManager()
{
        @Override
        public java.security.cert.X509Certificate[] getAcceptedIssuers() {
          return null;
        }

        @Override
        public void checkClientTrusted(final X509Certificate[] certs, final String authType)
{
        }

        @Override
        public void checkServerTrusted(final X509Certificate[] certs, final String authType)
{
        }

      } };

      sslContext.init(null, trustAllTrustManagers, new java.security.SecureRandom());
      SSLSocketFactory sslSocketFactory = new SSLSocketFactory(sslContext);
      Scheme sch = new Scheme("https", HTTP, sslSocketFactory);
      client.getConnectionManager().getSchemeRegistry().register(sch);


I get the below error
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

Please guide

Thanks,
Aparna


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message