2011-05-16 76 views

回答

4

有很多通過OpenSSL可用的算法,如AES和3DES。 OpenSSL不易使用,但它很強大。此外,還有很多教程。例如,在普通C中的here's a sample on how to en/decrypt with AES

然後是CommonCrypto庫。看到問題AES Encryption for an NSString on the iPhone,您可能最感興趣的部分是methods that extend NSData for encryption and decryption with AES

+0

此算法用於加密和解密文本格式。如何實現這個UIImage? – Sezhian 2011-05-16 15:30:30

+0

@Sezhian:[將UIImage轉換爲NSData](http://stackoverflow.com/questions/2240765/nsdata-to-uiimage)然後[使用我已鏈接的NSData類別用AES加密](http:/ /pastie.org/426530)。另一種方法更容易:使用NSData類別進行解密,然後使用[UIImage imageWithData:](http://developer.apple.com/library/ios/documentation/uikit/reference/UIImage_Class/Reference/Reference.html#//apple_ref/OCC/CLM /的UIImage/imageWithData :)。 – DarkDust 2011-05-16 18:43:07

2

您可以使用iOS SDK中提供的CommonCrypto庫。