如何通过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