AES_DECRYPT Weirdness
Posted by:
Thomas
Date: August 29, 2005 02:30PM
I have a 9 character string (alphanumeric - only A-Z0-9) encrypted with AES_ENCRYPT. I am using AES_DECRYPT to retrieve it. In the table I'm storing in a Column defined as VARCHAR(255).
Things work pretty well but out of 200K records I have found about 500 that will not decrypt. For those records AES_DECRYPT returns a NULL value.
Also this returns the record I want:
SELECT Stuff
FROM MyTableName
WHERE (EncryptedColumn = AES_ENCRYPT("9CharString", "MyKey"));
This does not:
SELECT Stuff
FROM MyTableName
WHERE (AES_DECRYPT(EncryptedColumn, "MyKey") = "9CharString");
I'm running version 4.1.7-standard on Redhat Linux with Perl.
I'm at a loss to figure out what the problem might be.
Am I using the wrong character set? (how do I find that out?)
Is my table column not big enough?
This is not an actual value, but to illustrate:
if my string should be ABC
I AES_DECRYPT is returning NULL.
If I change the string to ABB (encrypting with AES_ENCRYPT)
That works, as does ABD, but ABC still returns NULL.
Huh?
Subject
Views
Written By
Posted
AES_DECRYPT Weirdness
15393
August 29, 2005 02:30PM
5832
September 09, 2005 02:07PM
6188
September 13, 2005 02:54AM
5665
May 08, 2006 09:52AM
5335
May 09, 2006 06:39AM
4864
March 25, 2008 08:29PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.