由于项目需求sqlite3需要加密,不能随随便便就看到里面的数据,所有进行了两天的技术调研
参考:https://zhuanlan.zhihu.com/p/703309847
上面这篇文章十分好,解决了springboot加载解密后文件的难题。
1.利用加密工具sqllite3数据库加密,输出: 密码为:xxx的encrypt.db文件
bash
d:
cd D:\sqlite加密\a57fe-main\a57fe-main\命令行版sqlcipher
sqlcipher.exe ./mydb.db
ATTACH DATABASE 'encrypt.db' AS encrypt KEY 'xxx';
SELECT sqlcipher_export ('encrypt');
DETACH DATABASE encrypt;
2.springboot加载解密后的数据库文件:
bash
spring:
datasource:
url: jdbc:sqlite:./encrypt.db?key=xxx&cipher=sqlcipher&legacy=4
driver-class-name: org.sqlite.JDBC
加密工具在csdn上可以找到,付积分下载,我也是下载别人的。直接搜索sqlcipher加密工具即可
jdbc驱动包在上面的参考文献中可获得。
jdbc驱动包也可直接在 https://github.com/Willena/sqlite-jdbc-crypt/releases 直接下载。
3.读取加密数据库工具 DB.Browser.for.SQLite-v3.13.1-win64,都是免费工具,网络直接搜索即可下载。
