简体   繁体   中英

Android password protect sqlite

I have an android application in wich I can export/inport my database to sdcard.

I do it simply by using:

FileChannel src = new FileInputStream(currentDB).getChannel();
FileChannel dst = new FileOutputStream(backupDB).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();

What I would like to do is to password protect my exported database so if anyone tries to open it using sqlite browsing programms they would need to enter a password.

Can this be done(and how)?

Instead of protect database, you could encrypt file (exported database) there's some threads talking about this:

How to encrypt and decrypt file in Android?

Encrypting files with AES on Android

UPDATE1:

To decrypt file on desktop, there's this thread:

Decrypting data on desktop that was encrypted on android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM