SQLCipher with Room Persistence Library exception in SQLCipherUtils.getDatabaseState












1















I have a Room database in my Android app, and in my AppClass, I have some logic that checks the database encryption state in order to handle some potential encryption operations that might need to be performed on the database. However, whenever I call SQLCipherUtils.getDatabaseState on an encrypted database, it throws a SQLiteException. But the funny thing is that the state that is returned from getDatabaseState is not null and works perfectly fine, and the try-catch block surrounding the call to getDatabaseState doesn't catch the exception. So the exception doesn't affect the rest of the logic, from what I can tell. However, it is frustrating to see this error show up in the LogCat every single time the app lauches after the database has been encrypted. So my question is, is this error actually indicative of a problem? If so, how can I fix it, and if not, how can I silence the error?



Database Logic in Application class (Exception thrown on first line):



    try {
// Get database state
SQLCipherUtils.State state = SQLCipherUtils.getDatabaseState(getApplicationContext(), DB_NAME);

// Check whether database is encrypted
if (state == SQLCipherUtils.State.UNENCRYPTED) {
// If it's unencrypted, encrypt the database
try {
// Get database instance
FinancesDatabase db = FinancesDatabase.getDatabase(getApplicationContext());

// Close database
db.close();

// Encrypt database with encryption key
SQLCipherUtils.encrypt(getApplicationContext(), DB_NAME, sharedPrefs.getEncryptKey());
Timber.i("Successfully encrypted database!");

} catch (IOException e) {
Timber.e(e, "Failed to encrypt previously unencrypted database!");
}
} else if (state == SQLCipherUtils.State.ENCRYPTED)
// Otherwise, good to go
Timber.i("Database is encrypted. No action necessary.");

else if (state == SQLCipherUtils.State.DOES_NOT_EXIST)
// No database found. Normal if first launch
Timber.w("No database found.");

} catch(Exception e) {
Timber.e(e, "Failed to get database encryption state!");
}


Exception:



E/Database: file is not a database: , while compiling: select count(*) from sqlite_master;
net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:89)
at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:48)
at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:60)
at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1867)
at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1785)
at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2486)
at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2415)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1149)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1116)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1065)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1019)
at com.commonsware.cwac.saferoom.SQLCipherUtils.getDatabaseState(SQLCipherUtils.java:62)
at com.commonsware.cwac.saferoom.SQLCipherUtils.getDatabaseState(SQLCipherUtils.java:46)
at edu.usm.cs.csc414.pocketfinances.AppClass.onCreate(AppClass.java:118)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6056)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)


SQLCipherUtils.getDatabaseState implementation in library:



public static State getDatabaseState(Context ctxt, String dbName) {
SQLiteDatabase.loadLibs(ctxt);

return(getDatabaseState(ctxt.getDatabasePath(dbName)));
}



public static State getDatabaseState(File dbPath) {
if (dbPath.exists()) {
SQLiteDatabase db=null;

try {
db=
SQLiteDatabase.openDatabase(dbPath.getAbsolutePath(), "",
null, SQLiteDatabase.OPEN_READONLY);

db.getVersion();

return(State.UNENCRYPTED);
}
catch (Exception e) {
return(State.ENCRYPTED);
}
finally {
if (db != null) {
db.close();
}
}
}

return(State.DOES_NOT_EXIST);
}









share|improve this question





























    1















    I have a Room database in my Android app, and in my AppClass, I have some logic that checks the database encryption state in order to handle some potential encryption operations that might need to be performed on the database. However, whenever I call SQLCipherUtils.getDatabaseState on an encrypted database, it throws a SQLiteException. But the funny thing is that the state that is returned from getDatabaseState is not null and works perfectly fine, and the try-catch block surrounding the call to getDatabaseState doesn't catch the exception. So the exception doesn't affect the rest of the logic, from what I can tell. However, it is frustrating to see this error show up in the LogCat every single time the app lauches after the database has been encrypted. So my question is, is this error actually indicative of a problem? If so, how can I fix it, and if not, how can I silence the error?



    Database Logic in Application class (Exception thrown on first line):



        try {
    // Get database state
    SQLCipherUtils.State state = SQLCipherUtils.getDatabaseState(getApplicationContext(), DB_NAME);

    // Check whether database is encrypted
    if (state == SQLCipherUtils.State.UNENCRYPTED) {
    // If it's unencrypted, encrypt the database
    try {
    // Get database instance
    FinancesDatabase db = FinancesDatabase.getDatabase(getApplicationContext());

    // Close database
    db.close();

    // Encrypt database with encryption key
    SQLCipherUtils.encrypt(getApplicationContext(), DB_NAME, sharedPrefs.getEncryptKey());
    Timber.i("Successfully encrypted database!");

    } catch (IOException e) {
    Timber.e(e, "Failed to encrypt previously unencrypted database!");
    }
    } else if (state == SQLCipherUtils.State.ENCRYPTED)
    // Otherwise, good to go
    Timber.i("Database is encrypted. No action necessary.");

    else if (state == SQLCipherUtils.State.DOES_NOT_EXIST)
    // No database found. Normal if first launch
    Timber.w("No database found.");

    } catch(Exception e) {
    Timber.e(e, "Failed to get database encryption state!");
    }


    Exception:



    E/Database: file is not a database: , while compiling: select count(*) from sqlite_master;
    net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
    at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
    at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
    at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
    at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:89)
    at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:48)
    at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:60)
    at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1867)
    at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1785)
    at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2486)
    at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2415)
    at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1149)
    at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1116)
    at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1065)
    at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1019)
    at com.commonsware.cwac.saferoom.SQLCipherUtils.getDatabaseState(SQLCipherUtils.java:62)
    at com.commonsware.cwac.saferoom.SQLCipherUtils.getDatabaseState(SQLCipherUtils.java:46)
    at edu.usm.cs.csc414.pocketfinances.AppClass.onCreate(AppClass.java:118)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1125)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6056)
    at android.app.ActivityThread.-wrap1(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6938)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)


    SQLCipherUtils.getDatabaseState implementation in library:



    public static State getDatabaseState(Context ctxt, String dbName) {
    SQLiteDatabase.loadLibs(ctxt);

    return(getDatabaseState(ctxt.getDatabasePath(dbName)));
    }



    public static State getDatabaseState(File dbPath) {
    if (dbPath.exists()) {
    SQLiteDatabase db=null;

    try {
    db=
    SQLiteDatabase.openDatabase(dbPath.getAbsolutePath(), "",
    null, SQLiteDatabase.OPEN_READONLY);

    db.getVersion();

    return(State.UNENCRYPTED);
    }
    catch (Exception e) {
    return(State.ENCRYPTED);
    }
    finally {
    if (db != null) {
    db.close();
    }
    }
    }

    return(State.DOES_NOT_EXIST);
    }









    share|improve this question



























      1












      1








      1








      I have a Room database in my Android app, and in my AppClass, I have some logic that checks the database encryption state in order to handle some potential encryption operations that might need to be performed on the database. However, whenever I call SQLCipherUtils.getDatabaseState on an encrypted database, it throws a SQLiteException. But the funny thing is that the state that is returned from getDatabaseState is not null and works perfectly fine, and the try-catch block surrounding the call to getDatabaseState doesn't catch the exception. So the exception doesn't affect the rest of the logic, from what I can tell. However, it is frustrating to see this error show up in the LogCat every single time the app lauches after the database has been encrypted. So my question is, is this error actually indicative of a problem? If so, how can I fix it, and if not, how can I silence the error?



      Database Logic in Application class (Exception thrown on first line):



          try {
      // Get database state
      SQLCipherUtils.State state = SQLCipherUtils.getDatabaseState(getApplicationContext(), DB_NAME);

      // Check whether database is encrypted
      if (state == SQLCipherUtils.State.UNENCRYPTED) {
      // If it's unencrypted, encrypt the database
      try {
      // Get database instance
      FinancesDatabase db = FinancesDatabase.getDatabase(getApplicationContext());

      // Close database
      db.close();

      // Encrypt database with encryption key
      SQLCipherUtils.encrypt(getApplicationContext(), DB_NAME, sharedPrefs.getEncryptKey());
      Timber.i("Successfully encrypted database!");

      } catch (IOException e) {
      Timber.e(e, "Failed to encrypt previously unencrypted database!");
      }
      } else if (state == SQLCipherUtils.State.ENCRYPTED)
      // Otherwise, good to go
      Timber.i("Database is encrypted. No action necessary.");

      else if (state == SQLCipherUtils.State.DOES_NOT_EXIST)
      // No database found. Normal if first launch
      Timber.w("No database found.");

      } catch(Exception e) {
      Timber.e(e, "Failed to get database encryption state!");
      }


      Exception:



      E/Database: file is not a database: , while compiling: select count(*) from sqlite_master;
      net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
      at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
      at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
      at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
      at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:89)
      at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:48)
      at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:60)
      at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1867)
      at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1785)
      at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2486)
      at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2415)
      at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1149)
      at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1116)
      at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1065)
      at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1019)
      at com.commonsware.cwac.saferoom.SQLCipherUtils.getDatabaseState(SQLCipherUtils.java:62)
      at com.commonsware.cwac.saferoom.SQLCipherUtils.getDatabaseState(SQLCipherUtils.java:46)
      at edu.usm.cs.csc414.pocketfinances.AppClass.onCreate(AppClass.java:118)
      at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1125)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6056)
      at android.app.ActivityThread.-wrap1(Unknown Source:0)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
      at android.os.Handler.dispatchMessage(Handler.java:105)
      at android.os.Looper.loop(Looper.java:164)
      at android.app.ActivityThread.main(ActivityThread.java:6938)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)


      SQLCipherUtils.getDatabaseState implementation in library:



      public static State getDatabaseState(Context ctxt, String dbName) {
      SQLiteDatabase.loadLibs(ctxt);

      return(getDatabaseState(ctxt.getDatabasePath(dbName)));
      }



      public static State getDatabaseState(File dbPath) {
      if (dbPath.exists()) {
      SQLiteDatabase db=null;

      try {
      db=
      SQLiteDatabase.openDatabase(dbPath.getAbsolutePath(), "",
      null, SQLiteDatabase.OPEN_READONLY);

      db.getVersion();

      return(State.UNENCRYPTED);
      }
      catch (Exception e) {
      return(State.ENCRYPTED);
      }
      finally {
      if (db != null) {
      db.close();
      }
      }
      }

      return(State.DOES_NOT_EXIST);
      }









      share|improve this question
















      I have a Room database in my Android app, and in my AppClass, I have some logic that checks the database encryption state in order to handle some potential encryption operations that might need to be performed on the database. However, whenever I call SQLCipherUtils.getDatabaseState on an encrypted database, it throws a SQLiteException. But the funny thing is that the state that is returned from getDatabaseState is not null and works perfectly fine, and the try-catch block surrounding the call to getDatabaseState doesn't catch the exception. So the exception doesn't affect the rest of the logic, from what I can tell. However, it is frustrating to see this error show up in the LogCat every single time the app lauches after the database has been encrypted. So my question is, is this error actually indicative of a problem? If so, how can I fix it, and if not, how can I silence the error?



      Database Logic in Application class (Exception thrown on first line):



          try {
      // Get database state
      SQLCipherUtils.State state = SQLCipherUtils.getDatabaseState(getApplicationContext(), DB_NAME);

      // Check whether database is encrypted
      if (state == SQLCipherUtils.State.UNENCRYPTED) {
      // If it's unencrypted, encrypt the database
      try {
      // Get database instance
      FinancesDatabase db = FinancesDatabase.getDatabase(getApplicationContext());

      // Close database
      db.close();

      // Encrypt database with encryption key
      SQLCipherUtils.encrypt(getApplicationContext(), DB_NAME, sharedPrefs.getEncryptKey());
      Timber.i("Successfully encrypted database!");

      } catch (IOException e) {
      Timber.e(e, "Failed to encrypt previously unencrypted database!");
      }
      } else if (state == SQLCipherUtils.State.ENCRYPTED)
      // Otherwise, good to go
      Timber.i("Database is encrypted. No action necessary.");

      else if (state == SQLCipherUtils.State.DOES_NOT_EXIST)
      // No database found. Normal if first launch
      Timber.w("No database found.");

      } catch(Exception e) {
      Timber.e(e, "Failed to get database encryption state!");
      }


      Exception:



      E/Database: file is not a database: , while compiling: select count(*) from sqlite_master;
      net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
      at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
      at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
      at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
      at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:89)
      at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:48)
      at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:60)
      at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1867)
      at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1785)
      at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2486)
      at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2415)
      at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1149)
      at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1116)
      at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1065)
      at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1019)
      at com.commonsware.cwac.saferoom.SQLCipherUtils.getDatabaseState(SQLCipherUtils.java:62)
      at com.commonsware.cwac.saferoom.SQLCipherUtils.getDatabaseState(SQLCipherUtils.java:46)
      at edu.usm.cs.csc414.pocketfinances.AppClass.onCreate(AppClass.java:118)
      at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1125)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6056)
      at android.app.ActivityThread.-wrap1(Unknown Source:0)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
      at android.os.Handler.dispatchMessage(Handler.java:105)
      at android.os.Looper.loop(Looper.java:164)
      at android.app.ActivityThread.main(ActivityThread.java:6938)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)


      SQLCipherUtils.getDatabaseState implementation in library:



      public static State getDatabaseState(Context ctxt, String dbName) {
      SQLiteDatabase.loadLibs(ctxt);

      return(getDatabaseState(ctxt.getDatabasePath(dbName)));
      }



      public static State getDatabaseState(File dbPath) {
      if (dbPath.exists()) {
      SQLiteDatabase db=null;

      try {
      db=
      SQLiteDatabase.openDatabase(dbPath.getAbsolutePath(), "",
      null, SQLiteDatabase.OPEN_READONLY);

      db.getVersion();

      return(State.UNENCRYPTED);
      }
      catch (Exception e) {
      return(State.ENCRYPTED);
      }
      finally {
      if (db != null) {
      db.close();
      }
      }
      }

      return(State.DOES_NOT_EXIST);
      }






      android sqlcipher commonsware-cwac






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 20:52









      CommonsWare

      767k13818721922




      767k13818721922










      asked Nov 23 '18 at 20:39









      Andrew FinkAndrew Fink

      228




      228
























          1 Answer
          1






          active

          oldest

          votes


















          1














          That is being logged directly by SQLCipher for Android. It will be logged any time an invalid passphrase is used. getDatabaseState() tries opening the database with the empty string as a passphrase, as that is the "passphrase" for an unencrypted database.



          Your options to avoid this log message are:




          • Don't use SQLCipher for Android, or


          • Don't use getDatabaseState(), plus ensure that the user never provides an invalid passphrase







          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452700%2fsqlcipher-with-room-persistence-library-exception-in-sqlcipherutils-getdatabases%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            That is being logged directly by SQLCipher for Android. It will be logged any time an invalid passphrase is used. getDatabaseState() tries opening the database with the empty string as a passphrase, as that is the "passphrase" for an unencrypted database.



            Your options to avoid this log message are:




            • Don't use SQLCipher for Android, or


            • Don't use getDatabaseState(), plus ensure that the user never provides an invalid passphrase







            share|improve this answer




























              1














              That is being logged directly by SQLCipher for Android. It will be logged any time an invalid passphrase is used. getDatabaseState() tries opening the database with the empty string as a passphrase, as that is the "passphrase" for an unencrypted database.



              Your options to avoid this log message are:




              • Don't use SQLCipher for Android, or


              • Don't use getDatabaseState(), plus ensure that the user never provides an invalid passphrase







              share|improve this answer


























                1












                1








                1







                That is being logged directly by SQLCipher for Android. It will be logged any time an invalid passphrase is used. getDatabaseState() tries opening the database with the empty string as a passphrase, as that is the "passphrase" for an unencrypted database.



                Your options to avoid this log message are:




                • Don't use SQLCipher for Android, or


                • Don't use getDatabaseState(), plus ensure that the user never provides an invalid passphrase







                share|improve this answer













                That is being logged directly by SQLCipher for Android. It will be logged any time an invalid passphrase is used. getDatabaseState() tries opening the database with the empty string as a passphrase, as that is the "passphrase" for an unencrypted database.



                Your options to avoid this log message are:




                • Don't use SQLCipher for Android, or


                • Don't use getDatabaseState(), plus ensure that the user never provides an invalid passphrase








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 23 '18 at 20:59









                CommonsWareCommonsWare

                767k13818721922




                767k13818721922






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452700%2fsqlcipher-with-room-persistence-library-exception-in-sqlcipherutils-getdatabases%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Berounka

                    Sphinx de Gizeh

                    Different font size/position of beamer's navigation symbols template's content depending on regular/plain...