Skip to content

Which algorithm is used? #127

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

Closed
sergicastellsague opened this issue May 4, 2014 · 3 comments
Closed

Which algorithm is used? #127

sergicastellsague opened this issue May 4, 2014 · 3 comments

Comments

@sergicastellsague
Copy link

I can see in the brief documentation, that AES is used, but which Mode of operation? (http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation)

Thanks.

@developernotes
Copy link
Member

Hi @sergicastellsague

The default mode is CBC, though the algorithm, key size and mode can be changed with the PRAGMA cipher command.

@sergicastellsague
Copy link
Author

Hello @developernotes ,

Thanks for the reply. The link you provided looks like a raw query to SQLite database file.

Is it as "easy" as:

File databaseFile = getDatabasePath( "demo.db" );
        databaseFile.mkdirs();
        databaseFile.delete();

        database.execSQL("PRAGMA cipher = 'aes-256-ofb'");

?

And are all modes supported? In your documentation you state that you do not recommend changing it. For any concret reason?

@developernotes
Copy link
Member

Hello @sergicastellsague

The PRAGMA cipher command in this case would need to be run within the postKey event of a SQLiteDatabaseHook. An example of this can be found in the test suite here.

We generally do not recommend changing the default cipher unless you have a good reason to do so. The justification is most easily explained by flipping the question around, i.e. what is the benefit of changing the cipher? We have selected secure settings by default, and adjusting the cipher used could introduce compatibility issues in the future. Thus, unless there is a compelling reason, it is best to use the default values. For reference, a few alternate cipher modes are used in the standard SQLCipher test cases for validation of the features. To get a listing of options, you can run the following from a command prompt:

openssl -enc --help

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