tags:

views:

462

answers:

2

Hello,

I'm creating an app for the Android platform which will connect with just one site using https. It is essential that it won't be able to connect to any other sites, even with valid SSL certificates. I want it to be resistant to every form redirection (for example to site pretending to be the one I need to connect with) or other "attacks". Unfortunately I cannot find any good tutorial about SSL in Android... Do you know any? I'd be grateful for some links or advices. Or maybe could you give me some code snippets? My app is prepared to use HttpURLConnection or HttpClient - it makes no difference which path will I choose.

Thank you in advance :)

+1  A: 

Hardcoding URL not going to solve this ?

Alex Volovoy
URL is hardcoded :) I'm just afraid that some unknown, nasty network could send http request to a different ip (don't know if it is actually possible). The thing is I'd like to accept only one certificate, but I don't know how to instantiate HttpClient appropriately...
omarcin
I don't think i follow. You want to have you device make https connection to one address. Hardcoding URL/or IP will solve it. Please explain how you expect "nasty network" making http requests from the device, and inside your application.
Alex Volovoy
A: 

If you're really that paranoid then hardcoding a URL is not safe as a URL can point to a different IP when your DNS server is poisoned. These is not likely to happen though.

Hardcoding IP's can help to avoidthis problem as the server is directly accessed without a DNS name resolution.

vbsteven