I need to send encrypted data to a remote server from Objective-C using a web service. What encryption method should I use? It should support both Objective-C and the remote server.
Asked
Active
Viewed 1,349 times
1
-
Do you write both the server and the client? – Yuji Jul 13 '10 at 05:22
1 Answers
2
CommonCryptor.h is the header for C encryption on iPhone. It supports the following algorithms:
kCCAlgorithmAES128,
kCCAlgorithmDES,
kCCAlgorithm3DES,
kCCAlgorithmCAST,
kCCAlgorithmRC4
If you are on MacOS you have CommonCrypto plus all the OpenSSL options. I do not know of an Objective-C wrapper for these classes, but CommonCrypto is fairly simple as encryption goes.
Those algorithms are all common enough that you should not have any trouble finding an implementation, regardless of the server platform. If you have no compelling reason to choose another algorithm, AES is a reasonable pick.
Edit:
An answer to this similar question suggested SSCrypto as an Objective-C wrapper for OpenSSL.

Community
- 1
- 1

drawnonward
- 53,459
- 16
- 107
- 112
-
Thanks immediate response. is it possible decrypt in the server when encrypted username and password send by iphone/obj-c – sri Jul 13 '10 at 06:06
-
With these algorithms, the client and server must share an encryption key. If you want to only encrypt in the client and only decrypt on the server, you need public key encryption like RSA. – drawnonward Jul 13 '10 at 06:10