Android密码保护sqlite

时间:2015-03-18 14:58:56

标签: android sqlite android-sqlite

我有一个Android应用程序,我可以导出/导入我的数据库到SD卡。

我只是使用:

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

我想要做的是密码保护我导出的数据库,所以如果有人试图使用sqlite浏览程序打开它,他们需要输入密码。

可以这样做(以及如何)?

1 个答案:

答案 0 :(得分:1)

而不是保护数据库,你可以加密文件(导出的数据库),有一些线程在谈论这个:

How to encrypt and decrypt file in Android?

Encrypting files with AES on Android

<强> UPDATE1:

要在桌面上解密文件,就有这个帖子:

Decrypting data on desktop that was encrypted on android