Encrypted MySQL data with varying user number access

Neil Nand

I'm trying to think of a way to to store personal data in a MySQL database, which is accessed through a PHP application, and allows multiple users with different passwords access and the ability to add & remove users.

My original thinking was to encrypt the data in the database using AES so that it can be decrypted and read but what I'm not sure about is how to allow multiple users with different passwords to access it as there can only be one decryption key as far as I'm aware.

My only thought is set up a normal login system for users so they can be added & removed but store the decryption password on the server so the user never sees it. The thought of storing the decryption password on the server just seems insecure though so I'm looking for a better solution.

I'm sure this is a problem that many others have had and I've searched around but unless I'm misunderstanding things the only solutions I've found work with a set number of users, not in situations where users are added & removed.

Or is the way I'm going about this not the best and would there be a better way to approach this?

Also to define what I'm thinking of securing against. It's encase the server is hacked & the database stolen, the thief won't be able to read the data and stopping people who are no longer permitted to view the data from accessing it as well as adding new users.

Thanks for any help, Neil.

Oleg Dubas

Yes, the key (password for decrypting data) has to be stored on the server.
There's no way around this, unfortunately.

There are different ways to do it, though.

You can store it in form of a plain text file, somewhere in a folder outside of the users access zone, where only root system user will be able to get it.

You can store it in a different, separate database, with separate set of keys.

You can make your scripts get the key (or second database credentials) from some other script/app on the server, thus improving anti-transparency. In case someone will gain access to first script, he may not gain access to the other.

Finally, you can store it somewhere else, in depths of your network — and this is the most complex but secure thing, called KMS - Key Management Server.

Actually KMS doesn't have to be a cloud service or expensive enterprise solution (although, it's the most secure way). It can be just another server outside of the "war zone" (separate network) which stores and "tells" the key only to the trusted server.

I could write a book ~300 pages about managing keys, as I have supervised many quite sensitive data projects complying with PCI DDS3 security standards. You can google for key management and try to find some easy tutorials and schemes.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

R rbind varying number of data frames

From Dev

MySQL Database: Limit user access to data they created

From Dev

If a user has access to multiple encrypted pieces of data with AES encryption, would they be able to guess the encryption key?

From Dev

Storage encrypted data RSA in MySQL

From Dev

How to store encrypted data in mySQL

From Dev

Join two tables to get the number of total access for user in MySql

From Dev

MongoDB: Update user data based on varying JSON POST data

From Dev

Data access speed in LUKS encrypted partition

From Dev

Varying number of conditions

From Dev

RegEx for subdomain with varying number

From Dev

Ansible mysql_user module not accepting encrypted password

From Dev

Laravel request()->fingerprint() function and possibility of encrypted user data logging?

From Dev

Laravel request()->fingerprint() function and possibility of encrypted user data logging?

From Dev

System.Data.SQLite - cannot access an encrypted database

From Dev

Validator for varying amounts of data

From Dev

MySQL: Access denied for user to database

From Dev

mysql access denied for new user

From Dev

MySQL: User access and DB overwriting

From Dev

Extract Number from Varying String

From Dev

Dynamically varying number of nested for loops

From Dev

Creating a substring with a varying number of chars

From Dev

RSS to HTML with varying number of elements

From Dev

Vlookup varying column index number

From Dev

Finding the highest value of a varying number

From Dev

Extract Number from Varying String

From Dev

Regex match varying number of words

From Dev

Extracting a number of a string of varying lengths

From Dev

In R, how to take the mean of a varying number of elements for each row in a data frame?

From Dev

In R, how to take the mean of a varying number of elements for each row in a data frame?

Related Related

  1. 1

    R rbind varying number of data frames

  2. 2

    MySQL Database: Limit user access to data they created

  3. 3

    If a user has access to multiple encrypted pieces of data with AES encryption, would they be able to guess the encryption key?

  4. 4

    Storage encrypted data RSA in MySQL

  5. 5

    How to store encrypted data in mySQL

  6. 6

    Join two tables to get the number of total access for user in MySql

  7. 7

    MongoDB: Update user data based on varying JSON POST data

  8. 8

    Data access speed in LUKS encrypted partition

  9. 9

    Varying number of conditions

  10. 10

    RegEx for subdomain with varying number

  11. 11

    Ansible mysql_user module not accepting encrypted password

  12. 12

    Laravel request()->fingerprint() function and possibility of encrypted user data logging?

  13. 13

    Laravel request()->fingerprint() function and possibility of encrypted user data logging?

  14. 14

    System.Data.SQLite - cannot access an encrypted database

  15. 15

    Validator for varying amounts of data

  16. 16

    MySQL: Access denied for user to database

  17. 17

    mysql access denied for new user

  18. 18

    MySQL: User access and DB overwriting

  19. 19

    Extract Number from Varying String

  20. 20

    Dynamically varying number of nested for loops

  21. 21

    Creating a substring with a varying number of chars

  22. 22

    RSS to HTML with varying number of elements

  23. 23

    Vlookup varying column index number

  24. 24

    Finding the highest value of a varying number

  25. 25

    Extract Number from Varying String

  26. 26

    Regex match varying number of words

  27. 27

    Extracting a number of a string of varying lengths

  28. 28

    In R, how to take the mean of a varying number of elements for each row in a data frame?

  29. 29

    In R, how to take the mean of a varying number of elements for each row in a data frame?

HotTag

Archive