Can iOS support AES 256?

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

But there are a few answers in SO stating that this is possible, for example.

AES Encryption for NSString on iPhone

Can anyone answer?

+6
source share
3 answers

You can always use OpenSSL on iPhone, and it supports AES 256.

In this case, kCCAlgorithmAES128 means the length of the block 128, and not the length of the key. According to this sample code (found in this answer ) you just need to use kCCKeySizeAES256 for the keyLength parameter to support 256-bit keys.

+14
source

I recently discovered the NSData category (also NSString ) that implements AES decryption. Perhaps this is useful for gluing any data:

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

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

-

Another useful one, for example, might be Proper AES encryption with CommonCrypto . To support 256-bit keys, simply change kCCKeySizeAES128 to 256.

-

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

+4
source

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

0
source

Source: https://habr.com/ru/post/910235/


All Articles