【问题标题】:Decrypt sqlCipher in Maven project在 Maven 项目中解密 sqlCipher
【发布时间】:2020-08-26 07:06:25
【问题描述】:

我有一个带有已使用 SqlCipher (net.sqlcipher.database.SQLiteOpenHelper) 加密的数据库的 Android 项目。这一切正常,我可以通过我桌面上的数据库浏览器访问解密的数据。

但是,我有一个服务器端 Maven 项目(可以是任何项目,但这个是 Maven 项目)必须进一步处理数据。

我的问题是:如何解密数据以在 Java/Maven 项目中进行处理?

举个代码例子,我目前是这样访问数据库的:

try {
        Class.forName("org.sqlite.JDBC");
        c = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\Username\\Desktop\\"+path);
    }
    catch (Exception e) {
        System.err.println(e.getClass().getName() + ": " + e.getMessage());
    }
    return c;

我使用这样的结果集:

ResultSet myGet(Connection db, String sql){
    try {
        return db.createStatement().executeQuery(sql);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return null;
}

在加密数据库之前,上面的方法可以工作,但现在显然不行。我收到以下错误:

org.sqlite.SQLiteException: [SQLITE_NOTADB]  File opened that is not a database file (file is not a database)

【问题讨论】:

    标签: java maven encryption sqlcipher


    【解决方案1】:

    如果您使用 JDBC,您将需要专门构建的支持 SQLCipher 的驱动程序。 SQLCipher Enterprise Program 提供了这样的驱动程序。

    【讨论】:

      猜你喜欢
      • 2013-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-09
      • 1970-01-01
      相关资源
      最近更新 更多