I am completely new to cryptography but have been trying to make myself familiar with the concepts and applications. I have a project where I believe cryptography to be beneficial.

Project Info:

DB = MySQL 5.6

Engine = InnoDB

My application will reside on an intranet web server behind a network firewall with a very small white-list. Few users of this application will have the ability to add/remove values from the database. A larger number of users would be able to read these values. Values I would hope to encrypt could include:

  • emails
  • account numbers
  • paths
  • dates
  • unique ids

Largest table(s) would have up to 150k entries and total sessions likely to remain under 100.

Being an intranet site I assume (with limited security knowledge) that my primary threats will be malicious users, hardware theft, and persistent XSS from an internal or external source. I am doing my best to mitigate all of these.

Doing some research on how to encrypt my data while allowing it to be searchable leaves me with a few options (please correct wrong information);

  • CipherSweet Blind Indexing: requires library, may be overkill, false positives possible
  • MySQL AES_ENCRYPT/DECRYPT: if logs are compromised plaintext values will also be compromised
  • Application Side: runtime "nightmare", heavy load, could cause issues with multiple threads running


  1. While ugly and poor practice should application side encryption/decryption be acceptable for my environment?
  2. Would the likelihood of false positives with CipherSweet be negligible for my datasets?
  3. Given my environment, would letting MySQL handle the encryption/decryption be acceptable (neglecting hardware theft or server compromise)
  4. Bonus - should I be worrying about external XSS given my environment

I understand this question may fall into the category of discussion and if that is the case please direct me to where I may find further information to narrow my questions.


I am now also exploring the possibilities of using CryptDB or TDE.


I am working with MySQL Community Edition so it seems TDE will not be available to me unless there is a way to specifically acquire only this feature. Continuing to research other options. Any information is appreciated.

EDIT 3 For my OS I dont think I will be able to use CryptDB as in its docs it says:

  • Requirements: > Ubuntu 12.04, 13.04; Not tested on a different OS.
  • Did you see CryptDB? It might solve some of your issues.
    – kelalaka
    Jan 7, 2020 at 19:48
  • 1
    @kelalaka I had not but looking into it now. If it securely encrypts data at rest I will add it to my options. Thank you Jan 7, 2020 at 19:55

1 Answer 1


For the threats you mentioned the encryption of database is not really necessary.

  1. malicious users is a too broad definition. What threats do you expect? For instance, if you mean a threat that the user finds a way to get more privileges in the application than you assigned him or a threat that the user can impersonate him as some other user, then he will get the data that the application provides him, i.e. unencrypted data. Database with data encryption will not change anything.

  2. persistent XSS protection has nothing to do with database encryption. If your XSS protection fails, then the application will execute the malicious action triggered by XSS just like any other action of the user. It does not matter if the database is encrypted or not.

  3. hardware theft is more complicated. If the attacker can boot the OS and if the file system is not protected, then the attacker can put malicious code or crack your application code, launch your application and via application get access to the encrypted data, or even directly get access to data via database API. I would suggest you use an encrypted file system instead and to protect booting (and thus decryption) with a password. And when you create backups (database, configuration, maybe logs), encrypt them, too. Then the usage of encrypted DB will not give much additional security, whereas it will cost you much overhead. That's why you can use any normal database.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .