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

Adds --with-sqlcipher flag #232

Merged
merged 7 commits into from
Jun 20, 2018
Merged

Adds --with-sqlcipher flag #232

merged 7 commits into from
Jun 20, 2018

Conversation

WA9ACE
Copy link
Contributor

@WA9ACE WA9ACE commented Jun 6, 2018

Adds automatic support for compiling with sqlcipher to allow for encrypted database support.

Also adds a top-level eh? method to check if sqlite3 was installed/compiled with sqlcipher support.

@WA9ACE
Copy link
Contributor Author

WA9ACE commented Jun 6, 2018

Build passed on all rubies but head. Head test environment didn't install sqlite.

@gazayas
Copy link
Contributor

gazayas commented Jun 6, 2018

Interesting! I haven't seen an implementation of this in the gem itself, so I wonder what the moderators might think of this.
I know I'm not a moderator of this repository, so I don't know if this'll carry any weight...
But I thought changing the method name to using_sqlcipher_p for the c method and using_sqlcipher? for the ruby method would help to make it in line with the style of the other ? methods (like closed_p db.closed? in database.c).

@tenderlove tenderlove merged commit 918ffe0 into sparklemotion:master Jun 20, 2018
@padde
Copy link

padde commented Aug 22, 2019

@WA9ACE thanks for this. Do you happen to have example code for how to connect to sqlcipher from Ruby?

@WA9ACE
Copy link
Contributor Author

WA9ACE commented Aug 23, 2019

@padde sure! I'll try to put up a blog post this weekend on how to decrypt a sqlcipher database and query it with this.

@WA9ACE
Copy link
Contributor Author

WA9ACE commented Aug 24, 2019

@padde Here's a quick little tutorial on using sqlcipher from ruby with some example code. Let me know if you have any trouble! https://wa9ace.net/2019/08/24/how-to-query-sqlcipher-encrypted-databases-with-ruby.html

@padde
Copy link

padde commented Aug 24, 2019

@WA9ACE thank you! Very kind of you to put together a blog post. Now I understand how the pieces fit together. Have a good one!

@michaelpulis
Copy link

michaelpulis commented Mar 4, 2020

Hi! I am trying to install and use sqlcipher on Ruby, on Linux. Ruby, sqlite3 and sqlcipher are all installed on this machine.
I tried the following command:
gem install -- --with-sqlcipher

As well as the following command:
gem install sqlite3 -- --with-sqlcipher-dir=/opt/sqlcipher/

where /opt/sqlcipher/ is the path where sqlcipher is installed. This does not result in an error, but then the example cited on your website, written in ruby, gives the following error when trying to parse an encrypted .db file:
`initialize': file is encrypted or is not a database (SQLite3::NotADatabaseException)
The file was opened using sqlcipher normally frrom the terminal without any issues.

Do you have any idea why I can't get ruby to work with sqlcipher?

Thanks :)

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

Successfully merging this pull request may close these issues.

None yet

5 participants