This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/17535918/aes-gets-different-results-in-ios-and-java | |
- (NSData *)AES256EncryptWithKey:(NSString *)key { | |
// 'key' should be 32 bytes for AES256, will be null-padded otherwise | |
char keyPtr[kCCKeySizeAES256+1]; // room for terminator (unused) | |
bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding) | |
// fetch key data | |
[key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding]; | |