m4heshd / better-sqlite3-multiple-ciphers

better-sqlite3 with multiple-cipher encryption support 🔒
MIT License
140 stars 27 forks source link

Open a password protected better-sqlite3-multiple-ciphers database #14

Closed leean613 closed 2 years ago

leean613 commented 2 years ago

How can i open the encript database, with gui interface

m4heshd commented 2 years ago

Hello @leean613,

It depends on the GUI you're using. Something like DB4S?

leean613 commented 2 years ago

image the default encrypt type of better-sqlite3-multiple-ciphers is not sqlCipher, so i don't know what is the right way to fill this form (i suppose custom option, but how about the algorithm)

jove0610 commented 2 years ago

I have the same problem and I'm also using DB Browser for GUI. Even if I specify sqlcipher on pragma like so:

db.pragma("cipher='sqlcipher'");
db.pragma("key='123'");

I still can't open it if I click SQLCipher 3 and SQLCipher 4 options on the DB Browser.. There's no error message. It just closes the window then reopens it again.

m4heshd commented 2 years ago

As mentioned in issue #5, DB Browser for SQLite reads and creates DBs that has an encrypted header which is called the legacy mode in this extension. You have to create the DB using following pragma to be able to open it in DB4S.

const db = require('better-sqlite3-multiple-ciphers')(databasePath, { verbose: console.log });
db.pragma(`cipher='sqlcipher'`);
db.pragma(`legacy=4`);
db.pragma(`key='123'`);
julianpoemp commented 2 months ago

For anyone looking for a way to open the excrypted SQLite database with DBeaver: You can create a configuration as described here: https://gist.github.com/thecodingcod/a3987ddde8892d1a6bda8bd94febb7d0

I got it working with sqlite-jdbc-3.46.0.0.jar .