i have client-server application (objective-c and php).
how can i encrypt data on client and then decrypt on server?
the simpler the better

- 718
- 7
- 21
-
A much better deal than 40 days of Lent. – Charlie Martin Apr 18 '11 at 19:12
-
@Charlie, idk. matzoh makes you a bit plugged up – Naftali Apr 18 '11 at 19:20
3 Answers
Okay, rule number 1: DO NOT write your own cryptographic routines.
Given that, there are some standard cryptographic libraries available. OpenSSL is recommended in this SO article.

- 1
- 1

- 110,348
- 25
- 193
- 263
The simplest way to encrypt data traveling over the network is going to be to simply always use TLS to connect to your server running your PHP app. You could verify a particular certificate from within your app if you're afraid of sophisticated man in the middle attacks, though that will make your app fail to work without an update when your certificate changes.
If you truly need encryption/decryption at the application level, not just transport, then you should probably use RSA public-key encryption. Your client will have the public key, your server will have the private key. Apple has documentation on RSA encryption.

- 5,786
- 1
- 25
- 27