|
Mailing Lists
|
Home /
Groups /
SQL
MySQL AES DECRYPT Coldfusion 8 works, Coldfusion 9 returns binary
I have developed an application with CF8 and MySQL 5. Some of the data fields are encrypted using the MySQL AES_ENCRYPT function for INSERT and UPDATE and the AES_DECRYPT function for SELECT.Christian St.Germain 05/13/10 11:28 A > Queries (and dumps) all run fine with either SQL statements alone orLeigh _ 06/02/10 04:16 A > > Queries (and dumps) all run fine with either SQL statements alone orChristian St.Germain 06/14/10 02:58 P I have developed an application with CF8 and MySQL 5. Some of the data fields are encrypted using the MySQL AES_ENCRYPT function for INSERT and UPDATE and the AES_DECRYPT function for SELECT. Queries (and dumps) all run fine with either SQL statements alone or with cfc and cfm scripts in CF8. With CF9 however, the encrypted fields are returned as binary via cfdump even though the SQL statements themselves all run fine using Navicat for MySQL. I can overcome this by recoding he relevant cfm using CharsetEncode(datafield, "utf-8") but this results in an error when used with CF8. Any thoughts or suggestions would be greatly appreciated. I have tried this as well: http://www.compoundtheory.com/?action=displayPost&ID=421 ----- Excess quoted text cut - see Original Post for more ----- It sounds a lot like this old MySQL bug. Though the comments say it was fixed eons ago. If not, try casting it to a string in the sql http://bugs.mysql.com/bug.php?id=12872 ----- Excess quoted text cut - see Original Post for more ----- Yep that was it. Thanks so much for sorting that one out for me. Now the code works in both CF8 and CF9 This works: CAST(AES_DECRYPT('fieldname', 'key') AS CHAR) AS 'alias' The field types in question are varchar. The default encoding is UTF-8. There does not seem to be a need to provide an length limit argument in the CHAR function. i.e. CHAR alone works - not necessary to use CHAR(#). Thanks again.
|
May 18, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||