JAVA : ByPass SSL Certificate

Anurag Dhunna
Viithiisys
Published in
1 min readMar 26, 2018
JAVA

In this post, we will see how we can bypass the SSL ( Secure Socket Layer) Certificate. In Java, web service development environment, developers always generate a test certificate using keytool.

While doing client testing, often times, the web service test client will hit following error messages :

  • java.security.cert.CertificateException: No name matching localhost found
  • SunCertPathBuilderException: unable to find valid certification path to requested target

Here’s a source code: A very useful code in testing environment ONLY
Warning: Don’t try this on a production server. The production server should be SSL protected.

Hope you enjoyed the article and learned something. Feel free to let me know if something is incorrect!

If you liked ❤ this article, please hit 👏 clap

If you know someone who might extract value please share. I’ll be looking for your opinion and suggestions in the comments.

Also, to be notified about my new articles and stories, follow me on Medium and Twitter. You can find me on LinkedIn as well. Cheers!

--

--

Anurag Dhunna
Viithiisys

Android, Java Software Developer. I write about technologies that I used in the journey of programming. Email: anurag.dhunna@gmail.com