I've developed a website where people add their sensitive data. Not credit cards, but lets say they share things about themselves which are private and it wouldn't be good if other people see that info. Some of the data is private, some is public.

I want to keep the private data private as in... If someone breaks into the server I want them to be able to extract encrypted versions, rather than plane text about my users' accounts.

What I've thought about so far is the following. 1. SSL certificate (doesn't really protect the data on the server, but the connection) 2. the data which is market private to be encrypted by a series of algorithms (I would imagine that would be heavy on the server) 3. encrypt the php functions which encodes/decodes the data.

I'm not very well prepared for this tho, so I would like to know what is considered best practice for my situation? Am I overcomplicating the process?

The thing is that the app is not generating any income so I can't afford a sys admin, nor I'm able to look after the traffic 24/7. I'm looking for a solution which will take care on its own. Also I can't spend $$$ on sophisticated software that would do the job. I'm looking to bootstrap the app as much as possible. I can afford the SSL cert but not a 600$ Zend Guard for instance.

PS. I've used codeigniter so far to write my php code if that matters.


  • 3. Keep encrypt/decrypt methods unavailable from the web server (ie. outside the /var/www folder). Protect your server first, then security measure in case of intrusion second. Apr 12 '13 at 17:56

Most often, these break-ins occur through the application itself. If your encryption is transparent to the app, or to the part of the app through which the break-in occurs (i.e. encryption happens in a function called for any input/output data), then it is not adding any security.

At the same time if your encryption functions are only used explicitly in a few pages, then, say, SQL injection in another form will get the attacker only encrypted data.

In sum, limit the accessibility of unencrypted data throughout your app and check the remaining few places for at least SQL injection (use prepared statements). No need to encrypt the PHP itself - it is not going to help much against a determined attacker.


codeigniter has encryption routines that could be used to store sensitive information. It should be noted that encryption is just planning on failure. The root the problem is having vulnerabilities in your web application that allow an attacker to have access to your data. SQL Injection, XSS and CSRF must be addressed first. Its possible that a simple XSS vulnerabilities could be used to read plaintext sensitive information regardless of the use of encryption.

Make sure you master the OWASP top 10.

  • Hello Rook. I've made sure that I follow the best practice regarding codeigniter and I've addressed the vulnerabilities listed above. My concern is that I'm running the app on a self managed cloud server which I'm not sure how secure is. I'm wondering what are dating sites using in that sense? People are posting stuff about themselves and if it leaks its sensitive. Do you reckon they are just careless on how to store that data?
    – Ando
    Apr 12 '13 at 17:57
  • @Ando its almost always SQL Injection and encryption doesn't always help. SQL Injection is really slippery, and I guarantee you have violated some part of the OWASP top 10. Large companys that spend millions of dollars on security will violate the OWASP top 10, I see it every day.
    – rook
    Apr 12 '13 at 18:56
  • Thanks for all your suggestions. I'll look deeper into the OWASP top 10
    – Ando
    Apr 18 '13 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.