El 08/08/2012 10:58, jimbo escribió/wrote:
> I am having a nightmare with mySQL AES_DECRYPT.
>
> I can enrypt things fine, but how do you decrypt a column? For example, I write this line:
>
> insert into tblTest (TestColumn) VALUES (AES_ENCRYPT('testworks','encryptkey'))
>
> which happily inserts "testworks" in encrypted format
>
> When I then try and use:
>
> SELECT TestColumn, AES_DECRYPT(tblTest.TestColumn,'encryptkey') FROM tblTest;
>
> The decrypted column is just nulls.
And what does the _encrypted_ column look like?
mysql> SELECT
-> AES_ENCRYPT('testworks','encryptkey') AS encrypted,
-> AES_DECRYPT(AES_ENCRYPT('testworks','encryptkey'),
'encryptkey') AS decrypted;
+------------------+-----------+
| encrypted | decrypted |
+------------------+-----------+
| Õåó█I)╗#?Ðëxra←Ë | testworks |
+------------------+-----------+
1 row in set (0.00 sec)
> I've been reading google for ages, but I just can't make it work
The official manual is often a good alternative to random Googleing ;-)
http://dev.mysql.com/doc/refman/5.5/...functions.html
--
--
http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
http://borrame.com
-- Mi web de humor satinado:
http://www.demogracia.com
--