sousstudio's avatar

SQLite Encryption / SQLCipher

Hey all!

I'm developing a Laravel project requiring to secure stored data. Upon analyzing the solutions, and failing to find decent enough way of MySQL keys management, I've decided to go with SQLite, or to be exact, with sqlcipher. There are library to facilitate it:

https://github.com/abbat/pdo_sqlcipher https://github.com/sqlcipher/sqlcipher

The problem is I'm not quite sure how to add it to Laravel. In fact, as I see, it need a way to copy core sqlite routine and authorization procedure, preferably without changing the core itself (via controller, hook, Facade or helper perhaps?).

So, is there any clues on how to do it? How do I add new database support to Laravel?

Thanks!

0 likes
2 replies
sousstudio's avatar

Sorry for bumping up, but it seems in this forum so many questions, good part of them disappears in pagination.

JIC you're asking, the hosting is remote, no possibility to install security hardware. It must be available 24/7, so manual launch in case MySQL server died is not an option. I haven't found any good solution for MySQL or Postgre key management (where to store) - since no hardware available, the only way I see is to store keys elsewhere, which adds the complexity, but not security. And I don't think that simple file encryption is the right way to go.

I was thinking on application-level encryption, but in my understanding, it creates more problems than it solves. Like you can't properly use database (eg. searching, indexing, querying), if the data is encrypted. That means in order to make it work, as I see it, I must encrypt everything, and decrypt in JavaScript, on client's side. Which also means, I should 'simulate' all database activity on client's side, and read the whole base to client each time (as opposed to server-side processing).

So, I'm still convinced SQLCipher with sqlite database is a best way to go. And I really don't want to change Laravel's core to achieve what I want, so I'd be able to upgrade later.

Please or to participate in this conversation.