Alex Rivera | Logout

MySQL - How to store AES_Encrypted data?

Asked 2011-09-18T14:05:39.773
19

So I have been browsing the internet, and came across the MySQL built-in function AES_ENCRYPT. It doesn't seem too hard to use, but some sources tell me to store the encrypted data as a VARCHAR, and some say to store it as a BLOB. What should I store the encrypted data as?

Edit
Report

2 Answers

1

If you need to use VARCHAR, rather than BLOB, then convert the encrypted binary to Base64 which only uses printable characters and can be safely stored as VARCHAR. Of course you will need to convert it back from Base64 to binary before decrypting.

answered 2011-09-18T16:55:04.390
0

I have always used blobs to stored encrypted data in MySQL.

answered 2011-09-18T14:23:50.560

Your Answer