Securing sensitive data.

If I steal your web server how secure is all that encrypted data on the drive? The answer is usually "not at all". That's because the all-too-common method for encryption in web applications also stores the decryption key, unsecured, on the same server. Get the server, get the key. Get the key, get the data. It's that simple. The argument in favor of this method says that the key has to be there for the server to encrypt the data. Perhaps it's a coincidence that it's also a lot easier, and, speaking from personal experience, programmers are lazy by nature.

So that begs the question, "Is there a way that would keep the data secure even if the attacker has full access to the server?" Yes - and it's not new. It's just harder than the one-key-fits-all method. You have to blend one-key (Symmetric) encryption with two-key (Public Key) encryption.

Encryption:
  1. random 256-bit AES key generated - 128-bit is plenty strong enough, but hey, why not?
  2. random key used to encrypt the data
  3. RSA Public Key is used to encrypt the Random Key
  4. both the encrypted data and the encrypted key are stored in the database.

Decryption:
  1. login pass-phrase is strengthened into a 256-bit AES key
  2. strengthened key is used to decrypt that user's RSA Private Key
  3. RSA Private Key is used to decrypt the AES (Random) Key
  4. AES Key is used to decrypt the data.

Note that although the encryption key is stored on the server, it is encrypted and, more importantly, cannot be decrypted using anything on the server.

Since the whole decryption phase is kicked off with the user's login pass-phrase, an attacker would have to have that in addition to the encrypted data in order to get anywhere.


Most new PHP installations have everything you need:

If you're collecting sensitive information on your wesite (or websites that you've developed), you should be securing it properly. If you are not, or are not sure, give us a call. Let us discuss with you how Dialogs can empower you to securely work the web.

Recent Articles

Why are web developers flaky, shady, or worse?
It doesn’t have to be that way (and it really isn’t).

How much does a website cost? Well ...
Buying a website is a lot like buying a car.

Stories from the web development trenches.
Experience has value; inexperience pushes up project costs.

Don’t make your designer work in a vacuum. (pt 2)
Let’s look at SEO as an example of how technical stuff affects design.

Don’t make your designer work in a vacuum. (pt 1)
Successful website design requires an understanding of technical possibilities.

First two decisions when starting a website. (pt 3)
How do you choose the foundation of your next website?

First two decisions when starting a website. (pt 2)
How do you choose an agency?

First two decisions when starting a website. (pt 1)
Choose your web development software and choose an agency.

Agencies: explain the web using real-world comparisons (part 3 of 3).
Why does Google hate me?

Agencies: landing web projects using real-world comparisons (part 2 of 3).
Trust the process. Don't give away Discovery.

Our customers say it best

I continue to be amazed with Dialogs as a product and with the deep technical wisdom of the Dialogs consultants.

Alex W.