Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I accept a self-signed certificate?  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone!

I'm having a problems regarding HTTP connections using SSL, using a self-signed certificate.

The subject is about Android, but I believe that I can find a very good answer here (JavaRanch), although there will be some caveats of Android that I have to keep in mind.

Many articles and topics from forums and blogs, instruct about creating an SSLSocket factory, and set it on the HttpsURLConnection before making connections. But until I just have found pieces of codes (the IntellJ IDE is always complaining: cannot resolve symbol...), and nothing complete.

Does anyone have a COMPLETE EXAMPLE (no missing parts) in Java (JSSE*), about creating a SSLSocket factory for a self-signed certificate, accepting just my certificate, and finally, being able to perform HTTPS requests to my server?

P.S.: I have exported the certificate of my server and created a truststore .BKS.

Any help would be much appreciated.

Thank you very much!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!