• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading page through HTTPS from server with expired certificate  RSS feed

 
Miro Ricco
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • 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
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!