2

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

void
  • 718
  • 7
  • 21

3 Answers3

1

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.

Community
  • 1
  • 1
Charlie Martin
  • 110,348
  • 25
  • 193
  • 263
1

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.

Brock Batsell
  • 5,786
  • 1
  • 25
  • 27
0

Use SSL/TLS protocol, OpenSLL have the implementation of both, check this tutorial, its in c but may be a good start to you.

SIFE
  • 5,567
  • 7
  • 32
  • 46