今天本想寫一片 GAE+goAgent+SwitchySharp 的指南的!但是突然翻出了前段時間寫的關于iOS中的SQL數據庫文件加密的代碼,于是乎決定今天就先講講這個!~ 那么goAgent將放在周末,后續的文章中除了文件加密,還有傳輸數據加密,感興趣的童鞋 敬請留意。
言歸正傳,sql的文件加密,我們首先要用到一個庫,它就是大名鼎鼎的Sqlcipher, 奉上連接:http://sqlcipher.NET,在ios里 我們需要看的文檔是這一篇http://sqlcipher.Net/ios-tutorial/,文檔是全英文的,在此,不詳細闡述,只按步驟教大家怎么做,至于為什么做的問題,就需要自己去尋找答案了!
1.下載需要的庫 這里我們總共需要3個目錄的文件,分別是sqlcipher,openssl-xcode,openssl-1.0.0e。
首先下載第一個
% cd ~/Documents/code//命令行cd到你要下載的目錄 % curl -o openssl-1.0.0e.tar.gz http://www.openssl.org/source/openssl-1.0.0e.tar.gz//下載 % tar xzf openssl-1.0.0e.tar.gz //解壓縮
附:
SQLCipher uses the widely trusted and peer-reviewed OpenSSL library for all cryptographic functions including the AES-256 algorithm, pseudo random number generation, and PBKDF2 key derivation. OpenSSL isn't framework that is usable directly on the iPhone so we will setup our project to build and link against it as a static library.
Download the 1.0.x stable version from http://www.openssl.org/source/ and extract it to a folder on your system. Since the same OpenSSL source tree may be shared across multiple SQLCipher projects, it's a good idea to place this in some shared location outside of your project folder. Justs make a note of the source directory path for later.
(看不懂英文的童鞋也不用著急,跟著繼續做就好了,也很好理解)
OpenSSL是套開源的SSL套件,其函數庫是以C 主站蜘蛛池模板: 彝良县| 卢龙县| 安吉县| 南昌市| 平和县| 西安市| 吉安县| 胶州市| 长宁区| 本溪市| 临西县| 思南县| 建昌县| 新余市| 疏勒县| 铜鼓县| 余姚市| 神池县| 永泰县| 甘肃省| 银川市| 南开区| 时尚| 大同市| 东乌| 乌兰县| 丹阳市| 延寿县| 赞皇县| 元氏县| 利辛县| 台湾省| 济南市| 渝中区| 祁连县| 盈江县| 台湾省| 龙泉市| 昌平区| 拉萨市| 乡宁县|