Is there any algorithm to encrypt/decrypt the image in iPhone with password protection?
Asked
Active
Viewed 3,776 times
2 Answers
4
There are a lot of algorithms available through OpenSSL, like AES and 3DES. OpenSSL isn't easy to use but it's mighty. Also, there are a lot of tutorials out there. For example, here's a sample on how to en/decrypt with AES in plain C.
And then there's the CommonCrypto library. See the question AES Encryption for an NSString on the iPhone, the part you're likely most interested in are methods that extend NSData for encryption and decryption with AES.
-
This algorithm used for encrypt and decrypt text format.How to achieve this for UIImage? – Sezhian May 16 '11 at 15:30
-
@Sezhian: [Convert the UIImage to NSData](http://stackoverflow.com/questions/2240765/nsdata-to-uiimage) and then [use the NSData category I've linked to encrypt with AES](http://pastie.org/426530). The other way round is easier: decrypt with the NSData category and then use [UIImage imageWithData:](http://developer.apple.com/library/ios/documentation/uikit/reference/UIImage_Class/Reference/Reference.html#//apple_ref/occ/clm/UIImage/imageWithData:). – DarkDust May 16 '11 at 18:43