NSData-AES Class Encryption/Decryption in Cocoa

Why not use the built-in encryption algorithms? Here’s an NSData+AES i wrote which uses CCCrypt with a 256it key for AES256 encryption.

You can use it like:

NSData *data = [[NSData dataWithContentsOfFile:@"/etc/passwd"] 
                             encryptWithString:@"mykey"];

and decrypt it with:

NSData *file = [data decryptWithString:@"mykey"];

DISCLAIMER: There no guarantee my NSData+AES is bug-free 🙂 It’s fairly new. I welcome code reviews.

Leave a Comment