views:

42

answers:

1

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.

A: 

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.

drawnonward
Thanks immediate response. is it possible decrypt in the server when encrypted username and password send by iphone/obj-c
sri
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