SQLCipher android 資料庫加密

2021-09-12 04:46:54 字數 1584 閱讀 6961

專案中引入了sqlcipher之後,會讓你的程式體積驟然增加,打成apk後大概會變大好幾m,是更側重於檔案大小,還是更側重於程式安全,你應該根據具體的需求做出合適的判斷。

manifest 配置寫入檔案許可權 因為copy的資料庫檔案到建立的目錄下

module 下的build.gradle

compile 'net.zetetic:android-database-sqlcipher:3.5.3@aar'

sqlitedatabase.loadlibs(this);

建立乙個mydatabasehelper

public class mydatabasehelper extends sqliteopenhelper       

@override      

public void oncreate(sqlitedatabase db)       

@override     

public void onupgrade(sqlitedatabase db, int arg1, int arg2) 

}

關鍵** activity

資料庫加密之後 用工具無法開啟。這就足以說明,目前資料庫中的資料是非常安全的,只有在應用程式裡通過sqlcipher提供的api才可以訪問到資料庫裡的資料,使用其它的方式都無法獲取其資料。

[img]

建立目錄

/*** 建立sdcardfolder

*/public void createsdcardfolder()}}

sdcardutils

public static string getsdcardpath()

fileutil

public final static void writefile(inputstream input, string filename) throws ioexception

public final static void writefile(inputstream input, outputstream os) throws ioexception

os.close();

input.close();

}

我自己經歷的錯誤 :

1.你首先要確信 你的手機裡 沒有你現在建好的db 檔案 否則它會告訴你不能加密此檔案 :

[img]

2.我在as裡 使用了 eclipse 配置的方法 卻沒有在build.gradle檔案裡做配置 eclipse的配置這些so 檔案 jar包 zip 檔案 都要有

sourcesets

}

[img]

SQLCipher android 資料庫加密

專案中引入了sqlcipher之後,會讓你的程式體積驟然增加,打成apk後大概會變大好幾m,是更側重於檔案大小,還是更側重於程式安全,你應該根據具體的需求做出合適的判斷。manifest 配置寫入檔案許可權 因為copy的資料庫檔案到建立的目錄下 module 下的build.gradle comp...

mysql資料庫加索引 mysql資料庫加索引

新增普通索引 alter table cmf cz czfjbxx add index index xz xz alter table cmf cz czfjbxx add index index zzyt zzyt alter table cmf cz czrxx add index index ...

資料庫mysql欄位加換行 資料庫字段換行

存入資料庫前去空格 private string cleanstring stringnewstr return 製表符 char 9 換行符 char 10 回車符 char 13 查詢已存在的空格 select top 23 from dbo.school where charindex cha...