Like so many here, I'm trying to communicate with a site that has a self-signed cert. There are many many classes and code snippets showing how to do this, e.g. HTTPS GET (SSL) with Android and self-signed server certificate, but I can't find any that show how to actually use the classes. I've experimented a great deal, and I'm sure I'm just missing something simple.
To be specific, I am trying to use the classes supplied by "Moss"; the answer with the most votes. I still always get the "Not trusted cert" message. One other person in that topic has also asked for implementation hints, but has not been answered. Thanks for any help.
If I could append this question to that topic, I'd be much happier, but I guess newbies like me can only post new questions (although I've been a fan of SO for over a year).
We use a similar
SocketFactory
andX509TrustManager
implementation in some of our projects. In order to bind these classes up to your implementation, all you basically should have to do is hook them up to theHttpClient
(assuming that's what you're using) used for client-server communication.We normally have a method to create an
HttpClient
with the mentioned factory and trustmanager. It looks somewhat like this and is loosely based on the link shown in the inline comments.Hope that helps with your implementation.
We can also use