I have looked into various posts about how to retrieve something via HTTPS on Android, from a server that uses a self-signed certificate. However, none of them seem to work - they all fail to remove the "javax.net.ssl.SSLException: Not trusted server certificate" message.
It is not an option to modify the server to have a trusted certificate, and it is also not an option to make the server certificate match the server's IP address.
Note, that the server will not have a DNS name, it will only have an IP-address. The GET request looks something like this:
https://username:[email protected]:443/blabla/index.php?param=1&param2=3
I am fully aware that this solution is prone to man-in-the-middle attacks etc.
So, the solution must ignore the lack of trust in the certificate, and ignore the hostname mismatch.
Does anybody know the code, that does this, using Java for Android?
There are plenty of attempts to explain this on stackoverflow.com, and plenty of code snippets, but they don't seem to work, and nobody has provided one block of code that solves this, as far as I can see. It would be interesting to know if somebody really solved this, or if Android simply blocks certificates that are not trusted.