Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Reading page through HTTPS from server with expired certificate

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anybody know if it is possible to read a page from HTTPS server on which is expired certificate using JSSE ?

I've found HttpClient from apache project (http://jakarta.apache.org/commons/httpclient/sslguide.html) which is able to read from server with self signed cert, but when cert is expired it throws exception.

Miro
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know, but I bet modifying HttpClient to ignore the cert would be pretty easy.
 
Miro Ricco
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solution:
It's necessary to implement own TrustManager which can be e.g. dummy trust manager ignoring all or manager which will do necessary logic...
This trust manager should be registered in SSLContext class using init method.
Connection must be done using socket created from SocketFactory returned from initialized SSLContext instance.
When using HttpsUrlConnection it's simpler, you only have to initialize SSLContext.
 
Did you miss me? Did you miss this tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic