I took down this Gist due to concerns about the security of the encryption/decryption part of this code (see comments below).
Rob Napier (@rnapier) has created a publicly available class that provides similar AES encryption/decryption functionality at https://github.com/rnapier/RNCryptor.
@gonecoding, what kind of API are you seeing for Base-64 encoding? From its name, it's not clear what
encryptString:
ordecryptString:
would take and return. My expectation would be thatencryptString:
would take anNSString
and return anNSData
.decryptString:
is unclear. PerhapsdecryptBase64:
, which would take Base64 data and return anNSData
. In any case, though it's challenging to see how that expands to the stream functions. If the Base64 data is in a file, can you use decryptFromURL:...? I would be thoughtful of what belongs in the cryptor and what doesn't. It's very easy to provide a function that does NSData <-> Base64 to wrap around the cryptor. And an NSStream that converts data to/from Base64 might be much more flexible than putting it directly into the cryptor.Do you have a use specific case in mind? Fork and code is great; also feel free to open issues.