Encrpytion between iPhone and a php page with Key exchange
I need to send data to and from a php-page from my iPhone application and now I have a couple of questions to get it right the first time, and the best result:)
Lets start with the transfer of data. Which is the best way to get the data from a php-page?
Option 1: Use NSString in a background thread
[[NSString allo开发者_运维问答c] initWithContentsOfURL:url];
Or Option 2: Use NSURLConnection with delegates?
Then we have the encryption part. I have google a little bit but haven't found so much. I need to be able to encrypt and decrypt on both sides (both in the iPhone app and on the php-page). What encryption is best for this? Are there any implementations of any good encryption?
And last, for key-exchange. I thinking of using diffie-hellman, which "require" large prime-numbers. Are there any easy way to generate such thing (on both the iPhone and the php-page)?
Have you considered using HTTPS? SSL/TLS seems to match what you're looking for in terms of encryption, key exchange, etc. HTTP on top of this will get you to transfer data to the PHP page.
精彩评论