Can iOS really support AES 256?

20,778

Solution 1

You can always use OpenSSL on iPhone, and that does support AES 256.

That being said, kCCAlgorithmAES128 means a block length of 128, not key length. According to this example code (found in this answer) you simply need to use kCCKeySizeAES256 for the keyLength parameter to get support for 256 bit keys.

Solution 2

Recently I discovered a category of NSData (also NSString) which implements AES en-/decryption. Maybe this is helpful to crypt any kind of data:

Adding methods to NSData and NSString using categories to provide AES256 encryption on iOS

But it seems to have an implementation issue, which makes it incompatible with openSSL.

--

Another useful like might be Properly encrypting with AES with CommonCrypto. To support 256 bit keys just change the kCCKeySizeAES128 to 256.

--

Last but not least this tread looks promising: Decode OpenSSL AES256 string in iOS

Solution 3

If you goto http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-36064/CommonCrypto/CommonCryptor.h and search AES256 on the page you will find the key size as 256 ,192,128 so yes it does support AES256 encryption.

Share:
20,778
Howard
Author by

Howard

(your about me is currently blank)

Updated on July 09, 2022

Comments

  • Howard
    Howard almost 2 years

    I have read the header of CommonCryptor.h, and only I can find kCCAlgorithmAES128

    But there are a few answer in SO stating it can, e.g.

    AES Encryption for an NSString on the iPhone

    Anyone can answer?