如何通過iso10126padding和CBC模式加密AES 256中的NSDATA,需要像android的密碼那樣做。請幫助用AES256加密來做NSData的加密。需要加密AES256
-1
A
回答
0
轉到這個問題,它會幫助你:AES Encryption for an NSString on the iPhone
或轉到:https://github.com/RNCryptor/RNCryptor
在Objective-C
對象 -
//
// Encryption
//
NSString *password = @"Secret password";
RNEncryptor *encryptor = [[RNEncryptor alloc] initWithPassword:password];
NSMutableData *ciphertext = [NSMutableData new];
// ... Each time data comes in, update the encryptor and accumulate some ciphertext ...
[ciphertext appendData:[encryptor updateWithData:data]];
// ... When data is done, finish up ...
[ciphertext appendData:[encryptor finalData]];
//
// Decryption
//
RNDecryptor *decryptor = [[RNDecryptor alloc] initWithPassword:password];
NSMutableData *plaintext = [NSMutableData new];
// ... Each time data comes in, update the decryptor and accumulate some plaintext ...
NSError *error = nil;
NSData *partialPlaintext = [decryptor updateWithData:data error:&error];
if (error != nil) {
NSLog(@"FAILED DECRYPT: %@", error);
return;
}
[plaintext appendData:partialPlaintext];
// ... When data is done, finish up ...
NSError *error = nil;
NSData *partialPlaintext = [decryptor finalDataAndReturnError:&error];
if (error != nil) {
NSLog(@"FAILED DECRYPT: %@", error);
return;
}
[ciphertext appendData:partialPlaintext];
0
您可以設置屬性爲可變形並使用您自己的Transformer類來應用加密/解密。
這是一個指南,可轉換的屬性: enter link description here
+0
任何有用的代碼Transformable屬性,因爲我需要iso10126填充和CBC模式,我認爲comoncrpto doest沒有相同的庫。 – Abhimanyu
相關問題
- 1. C#/ Java | AES256加密/解密
- 2. AES256加密/解密速度
- 3. 的NodeJS AES256加密是從網上AES256加密工具
- 4. AES256 JAVA加密不匹配,C#加密
- 5. AES256加密用PHP rijndael_256 ECB_MODE
- 6. AES256 iOS中的NSString加密
- 7. 在PHP中加密和JS解密 - AES256
- 8. ASP25中的AES256加密和解密
- 9. linux aes256與cbc加密/解密庫
- 10. AES256解密問題
- 11. AES256加密目標c執行
- 12. iPhone - 使用內置庫的AES256加密
- 13. xor加密幫助需要
- 14. 需要RSA加密幫助
- 15. 需要說明:加密
- 16. https上需要加密
- 17. 如何在PHP中解密iPhone加密的AES256文本
- 18. 需要密碼
- 19. 如何解密在nodejs中加密的golang中的AES256位密碼?
- 20. AES256 Libgcrypt密鑰長度無效
- 21. 如何在網絡(ASP)中解密AES256
- 22. 需要幫助在RSA加密(doFinal)
- 23. 在iPhone上需要AES加密幫助
- 24. 是否需要進行HTML加密?
- 25. 如何在golang中使用AES256-GCM加密文件?
- 26. 將.net aes256加密代碼轉換爲php
- 27. CTR-AES256加密不匹配OpenSSL -aes-256-ctr
- 28. 我可以使用PBKDF2生成AES256密鑰來加密和隱式驗證嗎?
- 29. 需要加密/解密方法在加密字符串中沒有'/'
- 30. 需要幫助在加密以及解密Java文件?
顯示一些代碼,你也嘗試了什麼,你在哪裏得到的問題 – 2016-04-29 10:12:22