Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 197109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:49:28+00:00 2026-05-11T16:49:28+00:00

I plan on using MySQL and it’s built-in encryption functionality to encrypt / decrypt

  • 0

I plan on using MySQL and it’s built-in encryption functionality to encrypt / decrypt certain columns in certain tables. The concern I have is that I need to store the key somewhere. I could certainly store the key in a file and control the permissions of that file and the permissions of the application that accesses it, but is that enough? I could also create a web service to get the key or something.

I am in a small shop where I would be the only one (possibly one other person) that would have access to the machine that the application was on. Edit: I should add that there is a web facing part of this application that would need to decrypt the data unless I added a tier.

I have looked ad nauseum, but no one seems to have a bulletproof answer.

Is this one of those problems where you have to settle for good enough? Given that I am using MySQL and PHP (possibly Python) is there a better way to approach this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:49:29+00:00Added an answer on May 11, 2026 at 4:49 pm

    I’m not sure if using MySQL build in encryption would be the best solution to your problem.

    PHP’s M_CRYPT package is thought to be quite good and it gives you the flexibility to choose the algorithm that is best suited for your needs.

    Storing your key on some other server has one big advantage: the key is not on the same machine as the encrypted data*). So as long as the attacker does not have enough control over the compromised machine, they cannot get to the key.
    If the attacker gains full control of the machine the data is stored on, they most likely will be able to query the web-service for the key.

    However, transmitting the key from one machine to another opens up an entire new area that needs to be secured. Probably involving more key’s and more encryption layers, thereby increasing the chance of mistakes being made.

    *) The other option is to enter the password upon webserver start up and only keep it in memory.

    Possible solution
    If seen a solution employed that used the following method for encrypting files for users with web access (I’m not sure of your environment, but it might be helpful):

    • Upon user creation, a long random key is assigned to the new user.
    • This random key is stored in an encrypted column in the user record.
      (only this column is encrypted as to not affect the performance of the rest of the record!)
    • The encryption of the random-key column is done with 1 master password, stored in a file or in memory.
      (The better option is to enter the password upon staring your webserver and only store it in memory.)
      (Another approach would be to let the user enter a password and use that to encrypt/decrypt the random-key column, but I’m not sure if that would increase or decrease security)
    • Every document that needs to be encrypted is encrypted with the random-key for that user and then stored on disk.
    • Documents are stored with minimal permissions in the file-system.

    The advantages of this approach are:
    1. The random-key is encrypted in the database. So you still have the added security of the database-server, in combination with the encrypted column.
    2. Documents are stored with different keys, if the attacker gets hold of a key, only part of the documents is compromised.

    However:
    If the attacker gets hold of the master password and has read access to the user-table, the entire system is, once more, broken.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 169k
  • Answers 169k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer UTF-8 does not use BOMs; it is an annoying misfeature… May 12, 2026 at 1:58 pm
  • Editorial Team
    Editorial Team added an answer Okay, the question doesn't seem to be entirely clear to… May 12, 2026 at 1:58 pm
  • Editorial Team
    Editorial Team added an answer This should work: for /r %%a in (*.cmd) do xcopy… May 12, 2026 at 1:58 pm

Related Questions

I plan on using MySQL and it's built-in encryption functionality to encrypt / decrypt
Summary of answers: Don't do it. The legal and financial implications will be disastrous.
I am working on a content management application in which the data being stored
i am very new to Adobe Air and i am having a hard time
I want to benchmark PHP vs Pylons. I want my comparison of both to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.