I’m using http://www.phpaes.com/ to encrypt some values and store them in a MySQL database. The column type for the database is VARBINARY(512) which is the only one that seemed to work.
The values (plain text) are strings not longer than 128 chars but as this is my first take on something more serious than plain md5 or such I do think I’m doing something very bad here. First of all, the initialization vector is always the same, but this really isn’t a concern for this project.
Problem is, when I decrypt the values, some values come out ok while other’s not. Any idea what could the problem be here?
I’m using OFB cypher mode, 256 bit key and the values are email addresses and phone numbers.
Any help would be much appreciated.
Thanks
I had a similar problem. You have to change the column type to
BLOB. If that doesn’t work, try trimming your strings or data or whatever.Also, MySQL comes with AES functionality. Did you consider that?