Skip to content
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

Problem connecting a database using SQLite Studio v3.4.0 #139

Closed
rossanoparis opened this issue Jan 25, 2024 · 2 comments
Closed

Problem connecting a database using SQLite Studio v3.4.0 #139

rossanoparis opened this issue Jan 25, 2024 · 2 comments

Comments

@rossanoparis
Copy link

Hallo at all

I'm using SQLite3 Multiple Ciphers v1.8.2 which I built from its source code.
I'm able to create an encrypted database file using this uri: uri=file:encrypt-02.db?mode=rwc&cache=private
To specify the encryption mode I use PRAGMAs in this way:

PRAGMA key = 'mypassphrase'
PRAGMA cipher = 'aes256cbc'

Everythings works fine, I'm able to create tables and so on ...
My problem arise when I want to connect such database in SQLite Studio v3.4.0

I get the following error
image

Am I doing something not allowed?
Should I specify something in "Cipher configuration"?

@utelle
Copy link
Owner

utelle commented Jan 25, 2024

I'm using SQLite3 Multiple Ciphers v1.8.2 which I built from its source code. I'm able to create an encrypted database file using this uri: uri=file:encrypt-02.db?mode=rwc&cache=private To specify the encryption mode I use PRAGMAs in this way:

PRAGMA key = 'mypassphrase'
PRAGMA cipher = 'aes256cbc'

Is this the exact order in which you performed the PRAGMA statements?

Everythings works fine, I'm able to create tables and so on ... My problem arise when I want to connect such database in SQLite Studio v3.4.0

If the answer to my above question is yes, it is not surprising that you couldn't open the database in SQLite Studio.

The order of PRAGMA statements matters! If PRAGMA key is executed first the library will use the default cipher scheme - that is, ChaCha20-Poly1305 unless you changed the default when compiling the library.

Executing PRAGMA cipher as the second statement will have no effect.

Am I doing something not allowed?

No. Just change the order of PRAGMA statements on creating the database to

PRAGMA cipher = 'aes256cbc'
PRAGMA key = 'mypassphrase'

Alternatively, you could specify cipher=aes256cbc as an URI parameter.

Should I specify something in "Cipher configuration"?

No, at least not for the cipher scheme aes256cbc.

@rossanoparis
Copy link
Author

rossanoparis commented Jan 26, 2024

Thank you @utelle, you are right of course.
My problem was due to PRAGMA execution order, which must be like this

PRAGMA cipher = 'aes256cbc'
PRAGMA key = 'mypassphrase'

@utelle utelle closed this as completed Jan 26, 2024
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

2 participants