I encrypted my password field and inserted it into a MySQL table.
After that I decrypted that column by
select fld_user,fld_pwd,AES_DECRYPT(fld_encryptedpwd,'key')
from users
where fld_id='1903';
But, the result is showing “BLOB”. I used Varbinary() as the datatype for encrypted column. What I should do ?
Solution for in MySQL Workbench is to toggle the following option for the SQL Editor: “Treat BINARY/VARBINARY as nonbinary character string.” At least on MacOS X, you’ll need to restart Workbench for the option to take effect. (You can also right click the value and do ‘Open Value in Viewer’).
If you don’t want to change the options in Workbench, you can use the CAST() function to return the result of AES_DECRYPT() as a string:
A trick to check/make sure what data type a function would return is to do the following using the MySQL CLI:
That will show which data type will be returned.
(Again, storing encrypted passwords: not so good.)