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

Suggested change to support SQLite Encryption Extension #506

Closed
barnettben opened this issue Mar 30, 2019 · 4 comments
Closed

Suggested change to support SQLite Encryption Extension #506

barnettben opened this issue Mar 30, 2019 · 4 comments

Comments

@barnettben
Copy link
Collaborator

I am building GRDBCustomSQLite so that I can use the SQLite Encryption Extension (for which I have purchased a license).

Unfortunately, GRDB appears to not support this and only supports SQLCipher for encrypted databases.

Using SQLite-SEE, my custom build has defined the preprocessor macro SQLITE_HAS_CODEC.

When this is defined, GRDB attempts to validate that SQLCipher has been correctly linked.

In this case however, we don't want to perform validation as the custom SQLite build has taken care of encryption duties.

I would like to request that we adjust this following section of code to allow support for custom SQLite-SEE builds. I am happy to offer a pull request with changes/doc updates if that would help.

My suggestion would be to change occurrences of:

#if SQLITE_HAS_CODEC

to

#if SQLITE_HAS_CODEC && !GRDB_SQLITE_SEE

Then if we want to use a custom build of SQLite-SEE, we can define GRDB_SQLITE_SEE in the .xcconfig files and will bypass the SQLCipher check.

If the extra macro is not defined, then there is no impact on existing users.

**GRDB flavor(s): GRDBCustom
**GRDB version: v3.7
**Installation method: Manual
**Xcode version: 10.2
**Swift version: 5
**Platform(s) running GRDB: iOS/macOS
**macOS version running Xcode: 10.14.4

@groue
Copy link
Owner

groue commented Mar 30, 2019

Hello @BenRB,

You have well explained your trouble.

I know that the current GRDB code tests both SQLITE_HAS_CODEC and GRDBCIPHER identifiers, and not always in the correct way, as you have noticed.

I would be happy to review a pull request that cleans up this situation.

@barnettben
Copy link
Collaborator Author

Thank you for the response. I now have a local version which appears to work with the encryption extension which I can push to my fork and open a pull request for initial review. It has the basics working and passes the same tests as the SQLCipher version (but updated with slightly different API).

Do you still want it based off the development branch? I have been working with Swift 5/Xcode 10.2 so perhaps it is best to base it on the GRDB-4.0 branch? Which is better for you?

@groue
Copy link
Owner

groue commented Apr 3, 2019

@BenRB I would be glad with your pull request! And as you have noticed, GRDB 4 is on the way. Yes, the GRDB-4.0 branch is the perfect target 👍

@groue
Copy link
Owner

groue commented Apr 3, 2019

Discussion has moved to #509.

@groue groue closed this as completed Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants