Skip to content

Error in Encrypting existing sqlite plain database! #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vickieStomar opened this issue Jan 10, 2013 · 4 comments
Closed

Error in Encrypting existing sqlite plain database! #85

vickieStomar opened this issue Jan 10, 2013 · 4 comments

Comments

@vickieStomar
Copy link

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.

@sjlombardo
Copy link
Member

In the first issue, sqlcipher_export literally exports data to the attached database. Thus, foodDatabase would not be encrypted, the encrypted database would be demo.db. You'd then need to close all database handles and rename demo.db.

With regard to the second issue, you need to specifically build a sqlcipher command line package, then call is with the explicit path to the binary. The command you are using now would use the system installed sqlite3 binary, which does not have the sqlcipher extension. See here for further information:

https://groups.google.com/group/sqlcipher/msg/059748cfb8d41c77

@JayNirgudkar
Copy link

Hi Stephen ... I am using http://sqlcipher.net/sqlcipher-api/ to try and encrypt my database... but i get the export error. i am using the sqlite crypt software. any suggestions???

@sjlombardo
Copy link
Member

@JayNirgudkar are you literally using sqlite-crypt (i.e. http://sqlite-crypt.com/)? If so, this is not compatible with SQLCipher, it is a completely different software package.

@JayNirgudkar
Copy link

On 2014-02-11 1:31 am, Stephen Lombardo wrote:

@JayNirgudkar [1] are you literally using sqlite-crypt (i.e.
http://sqlite-crypt.com/ [2])? If so, this is not compatible with
SQLCipher, it is a completely different software package.

Reply to this email directly or view it on GitHub [3].

Links:

[1] https://github.com/JayNirgudkar
[2] http://sqlite-crypt.com/
[3]
#85 (comment)

Hi,
I have also tried to compile sqlcipher using the following site,
after which i turned to sqlite-crypt. But i need to cipher a sqlite
database on windows and tried to use cygwin. It is giving a lot of
errors. I was able to solve the errors, but now i don't know what to do
ahead. I am new at this so any kind of help will go a long way.

http://retroshare.sourceforge.net/wiki/index.php/Win32CompileLibrariesMingw.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants