change the driver which is compatible with sqlcipher and modified the way to connect the encrypted sqlite db file

This commit is contained in:
ChessNineeee committed 2021-04-06 23:16:50 +08:00
1 parent aa2761b10e
commit f6da0c30ba
5 files changed
+61 -8

No files matched your search

@@ -1,5 +1,6 @@
package minsecurity.identity.sqlite;
import minsecurity.identity.persist.sqlite.Sqlite;
import minsecurity.identity.persist.sqlite.SqliteUtil;
import org.junit.Test;
@@ -11,4 +12,38 @@ public class SqliteTest {
System.out.println(SqliteUtil.home());
assertFalse(SqliteUtil.pathExists("/aaa/1.txt"));
}
@Test
public void TestSqliteOpen(){
try{
Sqlite.getInstance().openDefault();
boolean res = SqliteUtil.pathExists("/home/zhengqi/min/identity/identity.db");
if (!res){
throw new Exception("no target db file!!");
}
String homePath = SqliteUtil.home();
String filePath = homePath + "/test/";
Sqlite.getInstance().open(filePath);
boolean res1 = SqliteUtil.pathExists("/home/zhengqi/test/identity.db");
if (!res1){
throw new Exception("no target db file!!");
}
}catch (Exception ex){
System.out.println(ex.getMessage());
}
}
@Test
public void TestSqliteSetPasswd(){
try{
String newPasswd = "1DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99";
Sqlite.getInstance().setPasswd(newPasswd);
Sqlite.getInstance().open("/home/zhengqi/min/identity/");
// Sqlite.getInstance().getConn();
}catch (Exception ex){
System.out.println(ex.getMessage());
}
}
}