Skip to content

Error in Encrypting existing sqlite plain database! #85

Closed
@vickieStomar

Description

@vickieStomar

I am using this code
//source
unEncrypted = getDatabasePath("FoodDatabase.db");
encrypted = getDatabasePath("demo.db");

SQLiteDatabase vgpdb = SQLiteDatabase.openOrCreateDatabase(
unEncrypted, "", null);
vgpdb.rawExecSQL(String.format(
"ATTACH DATABASE '%s' AS encrypted KEY '%s'",
encrypted.getAbsolutePath(), "test123"));
vgpdb.rawExecSQL("SELECT sqlcipher_export('encrypted');");
vgpdb.execSQL("DETACH DATABASE encrypted;");
vgpdb.close();
//source
but not able to encrypte foodDatabase.db

please suggest me what am i doing wrong?

and if i uses command line then
sqlite3 FoodDatabase.db
sqlite>attach database 'food_en.db' as encrypted key 'test';
sqlite>select sqlcipher_export('encrypted');
ERROR : NO SUCH FUNCTION sqlcipher_export
here it creates food_en.db but with no contents with in it ; size 0kb

please suggest me what am doing wrong ? thank in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions