SSL certificates are important in the security and business aspect in the online world. This entails paying a little extra in order to get that extra security your site needs. After all, nobody wants all their data compromised because the site is not secure.
You can get SSL certificates at GoDaddy for a price of course. But what makes these even better is that there are online coupon codes where you can get such certificates at much lesser the original cost.
I use Apache’s HttpClient library for all my URL related needs. It is a marvelous library that does most of the job behind the scenes. Compared the Java’s URL class, it is not as easy to use as Apache’s HttpClient. While using this library, a site that I commonly check for updates threw the exception message javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated.
When I checked the site, it seemed that its SSL certificated had expired. The only workaround for this is to create your own TrustManager. This class actually checks if the SSL certificate is valid. The scheme used by SSL is called X.509 and Java has a specific TrustManager for this scheme, called X509TrustManager.
This handy method created by theskeleton is just the perfect solution to have your HttpClient object bypass any SSL related errors and ensures that it accepts all SSL certificates of a site, whether it is expired or not.