Ruby on Rails and SQLite encrypted database
I am using Rails 5.2.2 and SQLCipher Version 3.2.0 (based on SQLite 3.8.6).
I have encrypted the SQLite database using sqlcipher but I am not able to load the rails application. The message is get is as follows:
SQLite3::NotADatabaseException: file is encrypted or is not a database: SELECT name FROM sqlite_master WHERE name <> 'sqlite_sequence' AND name = 'schema_migrations' AND type IN ('table')
I think that my issue lies in updating the file config/database.yml and specifying the password. I have tried specifying options like password, key, etc. but with no success.
I was wondering whether it is at all possible to use encrypted SQLite database in rails?
ruby-on-rails sqlite3 sqlcipher
add a comment |
I am using Rails 5.2.2 and SQLCipher Version 3.2.0 (based on SQLite 3.8.6).
I have encrypted the SQLite database using sqlcipher but I am not able to load the rails application. The message is get is as follows:
SQLite3::NotADatabaseException: file is encrypted or is not a database: SELECT name FROM sqlite_master WHERE name <> 'sqlite_sequence' AND name = 'schema_migrations' AND type IN ('table')
I think that my issue lies in updating the file config/database.yml and specifying the password. I have tried specifying options like password, key, etc. but with no success.
I was wondering whether it is at all possible to use encrypted SQLite database in rails?
ruby-on-rails sqlite3 sqlcipher
Unless the Ruby sqlite bindings you're using is a version that specifically supports this sqlcipher thing, no, it won't be able to open the database.
– Shawn
Jan 1 at 14:52
Hi, my ruby version is 2.5.3. How can I check whether this supports sqlcipher?
– Rahul
Jan 1 at 16:18
add a comment |
I am using Rails 5.2.2 and SQLCipher Version 3.2.0 (based on SQLite 3.8.6).
I have encrypted the SQLite database using sqlcipher but I am not able to load the rails application. The message is get is as follows:
SQLite3::NotADatabaseException: file is encrypted or is not a database: SELECT name FROM sqlite_master WHERE name <> 'sqlite_sequence' AND name = 'schema_migrations' AND type IN ('table')
I think that my issue lies in updating the file config/database.yml and specifying the password. I have tried specifying options like password, key, etc. but with no success.
I was wondering whether it is at all possible to use encrypted SQLite database in rails?
ruby-on-rails sqlite3 sqlcipher
I am using Rails 5.2.2 and SQLCipher Version 3.2.0 (based on SQLite 3.8.6).
I have encrypted the SQLite database using sqlcipher but I am not able to load the rails application. The message is get is as follows:
SQLite3::NotADatabaseException: file is encrypted or is not a database: SELECT name FROM sqlite_master WHERE name <> 'sqlite_sequence' AND name = 'schema_migrations' AND type IN ('table')
I think that my issue lies in updating the file config/database.yml and specifying the password. I have tried specifying options like password, key, etc. but with no success.
I was wondering whether it is at all possible to use encrypted SQLite database in rails?
ruby-on-rails sqlite3 sqlcipher
ruby-on-rails sqlite3 sqlcipher
edited Jan 1 at 16:58


James Z
11.2k71935
11.2k71935
asked Jan 1 at 12:09
RahulRahul
1
1
Unless the Ruby sqlite bindings you're using is a version that specifically supports this sqlcipher thing, no, it won't be able to open the database.
– Shawn
Jan 1 at 14:52
Hi, my ruby version is 2.5.3. How can I check whether this supports sqlcipher?
– Rahul
Jan 1 at 16:18
add a comment |
Unless the Ruby sqlite bindings you're using is a version that specifically supports this sqlcipher thing, no, it won't be able to open the database.
– Shawn
Jan 1 at 14:52
Hi, my ruby version is 2.5.3. How can I check whether this supports sqlcipher?
– Rahul
Jan 1 at 16:18
Unless the Ruby sqlite bindings you're using is a version that specifically supports this sqlcipher thing, no, it won't be able to open the database.
– Shawn
Jan 1 at 14:52
Unless the Ruby sqlite bindings you're using is a version that specifically supports this sqlcipher thing, no, it won't be able to open the database.
– Shawn
Jan 1 at 14:52
Hi, my ruby version is 2.5.3. How can I check whether this supports sqlcipher?
– Rahul
Jan 1 at 16:18
Hi, my ruby version is 2.5.3. How can I check whether this supports sqlcipher?
– Rahul
Jan 1 at 16:18
add a comment |
1 Answer
1
active
oldest
votes
It's not a matter of which version of Ruby you are using, it's a matter of does there exist an adapter for the database you would like to use.
Rails tries to talk to all databases the same way, each database technology needs to provide an adapter
to translate what Rails is asking for into the commands needed by that database technology to accomplish what Rails is asking for.
This configuration is done in the config/database.yml file, which might look something like the following (notice the adapter stanza):
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
There are many database adapters available, including SQLite, but I have not seen any for SQLCipher, you might have better luck searching than I did.
From what I have seen most Rails apps don't encrypt the entire database, but do however encrypt certain columns, for example storing some encrypted version of a password or access token.
Thank you for the great information. This is what I started to suspect and spent whole time yesterday in looking for a suitable database adapter but no luck till now. Yes, column wise encryption is what is done in most cases and some databases do only that. I somehow feel that ability to use encrypted sqlite database is a very powerful usecase, and have noted this issue in my to do list for daily research, as soon as I make a breakthrough will post the updates.
– Rahul
Jan 2 at 5:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53995316%2fruby-on-rails-and-sqlite-encrypted-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's not a matter of which version of Ruby you are using, it's a matter of does there exist an adapter for the database you would like to use.
Rails tries to talk to all databases the same way, each database technology needs to provide an adapter
to translate what Rails is asking for into the commands needed by that database technology to accomplish what Rails is asking for.
This configuration is done in the config/database.yml file, which might look something like the following (notice the adapter stanza):
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
There are many database adapters available, including SQLite, but I have not seen any for SQLCipher, you might have better luck searching than I did.
From what I have seen most Rails apps don't encrypt the entire database, but do however encrypt certain columns, for example storing some encrypted version of a password or access token.
Thank you for the great information. This is what I started to suspect and spent whole time yesterday in looking for a suitable database adapter but no luck till now. Yes, column wise encryption is what is done in most cases and some databases do only that. I somehow feel that ability to use encrypted sqlite database is a very powerful usecase, and have noted this issue in my to do list for daily research, as soon as I make a breakthrough will post the updates.
– Rahul
Jan 2 at 5:04
add a comment |
It's not a matter of which version of Ruby you are using, it's a matter of does there exist an adapter for the database you would like to use.
Rails tries to talk to all databases the same way, each database technology needs to provide an adapter
to translate what Rails is asking for into the commands needed by that database technology to accomplish what Rails is asking for.
This configuration is done in the config/database.yml file, which might look something like the following (notice the adapter stanza):
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
There are many database adapters available, including SQLite, but I have not seen any for SQLCipher, you might have better luck searching than I did.
From what I have seen most Rails apps don't encrypt the entire database, but do however encrypt certain columns, for example storing some encrypted version of a password or access token.
Thank you for the great information. This is what I started to suspect and spent whole time yesterday in looking for a suitable database adapter but no luck till now. Yes, column wise encryption is what is done in most cases and some databases do only that. I somehow feel that ability to use encrypted sqlite database is a very powerful usecase, and have noted this issue in my to do list for daily research, as soon as I make a breakthrough will post the updates.
– Rahul
Jan 2 at 5:04
add a comment |
It's not a matter of which version of Ruby you are using, it's a matter of does there exist an adapter for the database you would like to use.
Rails tries to talk to all databases the same way, each database technology needs to provide an adapter
to translate what Rails is asking for into the commands needed by that database technology to accomplish what Rails is asking for.
This configuration is done in the config/database.yml file, which might look something like the following (notice the adapter stanza):
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
There are many database adapters available, including SQLite, but I have not seen any for SQLCipher, you might have better luck searching than I did.
From what I have seen most Rails apps don't encrypt the entire database, but do however encrypt certain columns, for example storing some encrypted version of a password or access token.
It's not a matter of which version of Ruby you are using, it's a matter of does there exist an adapter for the database you would like to use.
Rails tries to talk to all databases the same way, each database technology needs to provide an adapter
to translate what Rails is asking for into the commands needed by that database technology to accomplish what Rails is asking for.
This configuration is done in the config/database.yml file, which might look something like the following (notice the adapter stanza):
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
There are many database adapters available, including SQLite, but I have not seen any for SQLCipher, you might have better luck searching than I did.
From what I have seen most Rails apps don't encrypt the entire database, but do however encrypt certain columns, for example storing some encrypted version of a password or access token.
answered Jan 1 at 17:06
nPnnPn
8,29262245
8,29262245
Thank you for the great information. This is what I started to suspect and spent whole time yesterday in looking for a suitable database adapter but no luck till now. Yes, column wise encryption is what is done in most cases and some databases do only that. I somehow feel that ability to use encrypted sqlite database is a very powerful usecase, and have noted this issue in my to do list for daily research, as soon as I make a breakthrough will post the updates.
– Rahul
Jan 2 at 5:04
add a comment |
Thank you for the great information. This is what I started to suspect and spent whole time yesterday in looking for a suitable database adapter but no luck till now. Yes, column wise encryption is what is done in most cases and some databases do only that. I somehow feel that ability to use encrypted sqlite database is a very powerful usecase, and have noted this issue in my to do list for daily research, as soon as I make a breakthrough will post the updates.
– Rahul
Jan 2 at 5:04
Thank you for the great information. This is what I started to suspect and spent whole time yesterday in looking for a suitable database adapter but no luck till now. Yes, column wise encryption is what is done in most cases and some databases do only that. I somehow feel that ability to use encrypted sqlite database is a very powerful usecase, and have noted this issue in my to do list for daily research, as soon as I make a breakthrough will post the updates.
– Rahul
Jan 2 at 5:04
Thank you for the great information. This is what I started to suspect and spent whole time yesterday in looking for a suitable database adapter but no luck till now. Yes, column wise encryption is what is done in most cases and some databases do only that. I somehow feel that ability to use encrypted sqlite database is a very powerful usecase, and have noted this issue in my to do list for daily research, as soon as I make a breakthrough will post the updates.
– Rahul
Jan 2 at 5:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53995316%2fruby-on-rails-and-sqlite-encrypted-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Unless the Ruby sqlite bindings you're using is a version that specifically supports this sqlcipher thing, no, it won't be able to open the database.
– Shawn
Jan 1 at 14:52
Hi, my ruby version is 2.5.3. How can I check whether this supports sqlcipher?
– Rahul
Jan 1 at 16:18