星空网 > 软件开发 > 操作系统

iOS中使用RNCryptor对资源文件加密

原文:http://blog.csdn.net/chenpolu/article/details/46277587

RNCryptor源码https://github.com/RNCryptor/RNCryptor。 
基于RNCryptor我做了一个小工具,用来对资源文件先进行加密。(CXYRNCryptorTool) 
iOS中使用RNCryptor对资源文件加密images/loading.gif' data-original="http://img.blog.csdn.net/20150530193805165" />

加密后文件看起来是这样的: 
iOS中使用RNCryptor对资源文件加密

接着就可以把这些文件导入我们的项目工程(就和以前导入图片一样)。 

最后,就是对这些资源进行解密: (下面代码对01.cxy资源解密)

 1 NSData *encryptedData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"01.cxy" ofType:nil]]; 2  3   NSError *error; 4   NSData *decryptedData = [RNDecryptor decryptData:encryptedData 5                     withPassword:@"pwdcxy" 6                        error:&error]; 7   if (!error) { 8     NSLog(@"======dencrypt success!====="); 9     UIImage *image = [UIImage imageWithData:decryptedData];10     _imageView.image = image;11 12   }

注意:解密密码一定要和加密时一致。




原标题:iOS中使用RNCryptor对资源文件加密

关键词:IOS

IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

国际小包到巴西:https://www.goluckyvip.com/tag/102455.html
国际邮寄小包:https://www.goluckyvip.com/tag/102456.html
邮局国际小包:https://www.goluckyvip.com/tag/102457.html
国际小包单号:https://www.goluckyvip.com/tag/102458.html
国际电商小包:https://www.goluckyvip.com/tag/102459.html
独立站老司机:https://www.goluckyvip.com/tag/10246.html
海南岛琼海市旅游景点 琼海市的旅游景点:https://www.vstour.cn/a/363189.html
月活用户超20亿!万亿市值巨头对中国商家进一步开闸放流 :https://www.kjdsnews.com/a/1836412.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流