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

  • SEARCH
  • Home
  • 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 4110428
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:55:58+00:00 2026-05-20T21:55:58+00:00

I have been through several SO questions regarding this and my approach is a

  • 0

I have been through several SO questions regarding this and my approach is a bit different in terms of wanting to encrypt data. Here is what I want to do..

Basically all my customers data is stored in the database and after 3 weeks or 4 weeks, I don’t really need their data anymore such as address, city, state, zip, phone, email address, products they ordered etc.

Now this data is stored in raw format in the database (mysql).

What I am thinking is that after certain days, I will encrypt all the data which resides in mysql database and instead of storing the key, I will just enter it manually via input box each time (when wanting to encrypt it or if for some reason decrypt it just to display on the screen).

So basically here is how it would work..

1) Select the customer’s record in mysql

2) Get the encryption key via input box

3) Update the mysql record by encrypting the data

So here are my 2 questions…

1) Is the above mentioned a good strategy in the sense that if the database was compromised, the data would be secured. Additionally, if the intruder were to gain access to the code, they wouldn’t have access to a key because it would not be stored anywhere in any php files.

2) How should I setup the encryption system? Should I used the mysql’s function AES_ENCRYPT (Please keep in mind that the length of the data may vary such as the address, or email address or some other information about the customer)

  • 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-20T21:55:58+00:00Added an answer on May 20, 2026 at 9:55 pm

    This scheme sounds like it would work just fine. There’s only some details that you need to take care of.

    AES_ENCRYPT (which is fine — this also holds with any other encryption method you might use) returns a binary string. You need to store that inside a column that can hold binary strings (BINARY, VARBINARY, BLOB variants), whereas you probably store the pre-encryption information in nonbinary string columns. So you would either need to have another set of columns for the encrypted info, or use some text-based encoding to be able to put the encrypted data in the same columns you use for the unencrypted form.

    Also, you should be very careful in your application logic so as not to accidentally repopulate an encrypted row with unencrypted data (think scenarios such as view record -> decrypt -> save changes).

    Finally, if the bad guys have write access to your server/application then they might very well intercept the encryption key and save it. Since the key would likely be one and the same for all records (due to key management considerations) this would be enough for them to get all your data. But if they only manage read access, you are good.

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

Sidebar

Related Questions

I know there has been several questions regarding this very question and I have
I have been through numerous similar questions on this forum but my issue still
I have been reading through this wonderful website regarding the recommended Python IDEs and
I have seen several questions on this issue, but none of them have been
I've been trying to figure this out over several questions here on SO, finding
I have been reading through the backlog of answered questions on SO regarding How
There are several/many questions regarding TFS branching strategy, but I am haven't been able
I have been reading through this similar question and find myself less than satisfied
There have been several questions that have answered the HOW or more precisely how
I have been at this for several days now and tried all sorts of

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.