I should be asleep right now, but because I haven’t made a real post lately, I thought I would go with this topic tonight before I rest my head.
The topic is how to store secure data without an outside source. Let’s use a more detailed scenario. You have 1 computer. That computer serves up a form for users that requests their credit card number and other various billing information. Thanks to the wonders of Private/Public Key Encryption aka: SSL, you know this is done with today leading security technology. You get the credit card number, and you submit the transaction and your done.Â That’s all fine, That’s all safe.
The problem comes in when you want to create a recurring billing system. Instead of just submitting the transaction, you also have to store the credit card number. A majority of small business retailers have a hard time doing this. They maybe encrypt it before inserting it into a database. Heck, they may just leave the database plaintext. The fact of the matter is, it’s not an easy Task…
Looking at the options, you haveÂ a few choices when it comes to storing credit card data:
Don’t do it – This is probably the safest option, but doesn’t work when you want automatic billing.
Save to seperate machine – This works on the principle that if you can secure the machine, you can secure the data. The idea would be the user submits the data to the server, than forwards that data (securely) to another machine that isn’t connected to the internet. This can then work both ways and you can monitor that only traffic coming from the primary server gets through. That’s all fine, and of course you would want encryption and such for the data, but it’s probably the next best approach to not storing the data. However, if you only have 1 machine, this isn’t an option either.
You could make someone else store the data and hold them liable for the security. This costs money. Not an option.
So here we are… How to store it on 1 machine, securely…. Well the ideaÂ would be to encrypt the data with some sort of 2 way encryption where encryption password isn’t openly available.After a few trips to the bathroom and thinking about it a little, I think I came up with a solution that is… resonable.
It’s a 4 pass encryption system. And works like this:
Phase 1: User enters in Data and get’s pumped into the php file. In the php file, we use the mcrypt library to encrypt the numbers using a key and a cipher. Using just this method would be quite effective by itself, except the key is stored in a php document. Since PHP is not compiled, it can be easily viewed using a plaintext reader such as emacs if you gain access to the code. That said, this is still a pretty good step.
Phase 2: We do the same as above, but we use another key. This is just added security to make sure it takes more than 1 wave to decrypt this thing.
Phase 3: This is where my ideas may pay off. It’s still not 100% safe, but it gets the idea. Basically, I wrote my own PHP function to encrypt the data. Yes, my own PHP function. Not like a function written in PHP. This was a function, written in C, and COMPILED into PHP. It uses the same method to encrypt everytime. However, there is no built in decrypt function. In fact, there are only 2 ways to crack this particular solution. You either have to decompile the PHP source code (because I deleted the source after I compiled), and see what I changed. That might give you the key, if your lucky… But… I have a feeling it might not be that simple. Maybe some sort of memory management utility might help as well, if you can debug php. Needless to say, that way isn’t simple. The other method is brute force… and well… good luck with that. This is the most secure thing I can come up with mainly because it’s the one thing that even if all the data was completely compromised, this would take time for even the best hackers to figure out. Bomb Lab anyone?
Phase 4: This is the phase that everyone does…. You just encrypt the data going into the database one more time for database storage. Pretty good again, except to decrypt it, it’s like…. 1 line, still a good idea.
That said… to decrypt this credit card number, you need to compromise the mysql data, the php source file, and the php source code. The combination of the 3 is pretty dang good, and for most hackers, probably not worth their time. I’m debating if I should create another level of security, such as an md5 checksum to make sure certain things haven’t been comprised, but probably not worthwhile.
That said, if you have anymore ideas on how to improve the encryption, let me know.
How’s life you ask? Insanely busy. We’re getting more and more clients, and I am getting further and further behind. We need to finish the billing system SOON. That would help out a lot and would hopefully mean money coming into the program. That’s where we need to be.
Have spent a good amount of time with my sweety lately. Amber and I hung out tonight with my family from Nebraska. They arrived in town tonight, so we chatted with them awhile while I downloaded drivers for my scanner.
Tomorrow… Man… Tomorrow is nothing but more work.
Flying -> MSA -> Church -> JR Corps.
John got his laptop and now everyone seems to want one. If you want to know what to get: If your are not computer savy, own an ipod, and don’t care about playing games the day they come out… I would recommend the Apple Powerbook. If your like me, and you want freedom to use windows for compatability or linux for insane projects (not that you can’t use linux on a mac) then go with a Dell Latitude (NOT INSPIRON). In either case, if it’s a laptop, get a good warranty (like Dell’s 3 year complete care package). That’s my recommendations. I would also look for 802.11G and at least 512 megs of ram. Those are my recommended things for laptops now adays.
Let’s see. What else can I talk about for 4 minutes while I stay up even longer than I normally do. I’m using my wireless headphones again. I forgot how good they sound. They have nice bass on the low end and just the right balance for everything else. Not to mention comfy and not all that noticable. It’s cool to get up and walk around and have the music follow you without the wire. I can see why people like walkmen… I think this is still better though, except I can’t leave my house with them. Time to get a Radio Broadcast license for Ultra High Quality music (hmm, or data, we could call it DM for Data Modulation).
Well that’s my time. Enjoy the post.