I do a lot of things in MATLAB, and if I could make it wash my dishes, I would. Perhaps one of these days, I should venture out to the Simulink world to design and implement some controllers for a dish mounting/washing robot. But let's leave that for some other time. The other day, I wanted to create a simple database mechanism to store all of my username and passwords to various online accounts I had. Since this database would contain sensitive information, I needed this to be pretty secure. I knew that I could create a password-protected Excel file, but what fun would that be?
So I built this simple GUI in MATLAB that showed my username/password entries in a table format. I could add, change, or delete entries from the table. But I needed a way to store that data in an encrypted format. I know very little about data encryption but I know that there are sophisticated algorithms for it. I did a quick search on the File Exchange and found Jan's cryptAES. It implemented the 128-bit AES en/decryption. What that translates for me was that I now have a way of garbling my confidential files so that others can't see it! I can take my data from the table and encrypt it as some binary file using a passphrase I provide. When I open the GUI, I would type the passphrase which would load and decrypt the file.
His entry is purely written in MATLAB (without any calls to external functions like Java or MEX). While calling the Java method is significantly faster (see Rapid AES En/Decryption), Jan explained to me a couple of advantages for doing everything in MATLAB:
- He cannot control whether the CBC vector of the Java implementation is really random, because it depends on the active Java engine. He said he's seen too many advanced crypto-softwares failing due to poor random number generators.
- By P-coding the function (and not calling any external functions), it makes it harder for hackers to catch the intermediate state.
He acknowledges two other File Exchange entries - AES Toolbox and Rapid AES En/Decryption. Some of you may be interested in checking them out as well.
Thanks, Jan, for helping me solve my problem! And thank you for explaining to me a little more of your motivations in creating this entry.
Give this a try and let us know what you think here or leave a comment for Jan.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.