AlanQuatermain/aqtoolkit

AES encrypt options

hustwcw opened this issue · 2 comments

In the AES256EncryptedDataUsingKey method, I can't decryt the data using java when the options is set to kCCOptionPKCS7Padding. But when I modify the options to "kCCOptionPKCS7Padding | kCCOptionECBMode", I can decrypt correctly.
I haven't used the decryptedAES256DataUsingKey method in the iOS client, but I think the options in this method should alos be modified to "kCCOptionPKCS7Padding | kCCOptionECBMode".

ECB is pretty unsecure.

Even CBC is heading that way. The recommendation is going towards Galois/Counter Mode instead, although there aren't yet many implementations of that. Hopefully Apple will add it to CommonCrypto in the next revision.