提交 2bc833a3 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 b6c5b74c
...@@ -423,16 +423,19 @@ public class TestTools extends TestBase { ...@@ -423,16 +423,19 @@ public class TestTools extends TestBase {
private void testChangeFileEncryption() throws SQLException { private void testChangeFileEncryption() throws SQLException {
org.h2.Driver.load(); org.h2.Driver.load();
Connection conn = DriverManager.getConnection("jdbc:h2:" + baseDir + "/utils;CIPHER=XTEA", "sa", DeleteDbFiles.execute(baseDir, "utils", true);
"abc 123"); Connection conn = DriverManager.getConnection("jdbc:h2:" +
baseDir + "/utils;CIPHER=XTEA", "sa", "abc 123");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, DATA CLOB) " +
"AS SELECT X, SPACE(3000) FROM SYSTEM_RANGE(1, 300)");
conn.close(); conn.close();
String[] args = new String[] { "-dir", baseDir, "-db", "utils", "-cipher", "XTEA", "-decrypt", "abc", "-quiet" }; String[] args = new String[] { "-dir", baseDir, "-db", "utils", "-cipher", "XTEA", "-decrypt", "abc", "-quiet" };
ChangeFileEncryption.main(args); ChangeFileEncryption.main(args);
args = new String[] { "-dir", baseDir, "-db", "utils", "-cipher", "AES", "-encrypt", "def", "-quiet" }; args = new String[] { "-dir", baseDir, "-db", "utils", "-cipher", "AES", "-encrypt", "def", "-quiet" };
ChangeFileEncryption.main(args); ChangeFileEncryption.main(args);
conn = DriverManager.getConnection("jdbc:h2:" + baseDir + "/utils;CIPHER=AES", "sa", "def 123"); conn = DriverManager.getConnection("jdbc:h2:" +
baseDir + "/utils;CIPHER=AES", "sa", "def 123");
stat = conn.createStatement(); stat = conn.createStatement();
stat.execute("SELECT * FROM TEST"); stat.execute("SELECT * FROM TEST");
conn.close(); conn.close();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论