AES_DECRYPT

AES_DECRYPT

am 23.06.2004 15:59:57 von Sapenov

------=_NextPart_000_00D1_01C45908.D711B990
Content-Type: text/plain;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable

Hi all,

I have problem with fetching records to php script.

table structure :
-----------------------
id int(10)
message text
----------------------

i place information into message field using following query=20

INSERT INTO table (message) VALUES (AES_ENCRYPT('$message','password'));

it works fine, as i see in mysqlcc

However, when I fire this query up both in php script and mysqlcc:

SELECT AES_DECRYPT(message,'password'),message FROM CRM_tickets WHERE =
id=3D'39'=20

it outputs following information:

------------------------------------------------------------ -------------=
------
AES_DECRYPT(message,'password') | message=20
------------------------------------------------------------ -------------=
------
decrypted text | encrypted text
| encrypted text
| encrypted text
| encrypted text
| encrypted text

------------------------------------------------------------ -------------=
------=20

*looks like function works off only once*


Regards,

Khazret Sapenov
Software Developer
CMS Inc
Toronto, Canada
=20

------=_NextPart_000_00D1_01C45908.D711B990--

Re: AES_DECRYPT

am 24.06.2004 00:54:53 von Paul Coldrey

Hi,

Works fine for me with the following test case:

CREATE TABLE Testing (
Message VARCHAR(100)
);

INSERT INTO Testing VALUES(AES_ENCRYPT("hello", "spam"));
INSERT INTO Testing VALUES(AES_ENCRYPT("test", "spam"));
INSERT INTO Testing VALUES(AES_ENCRYPT("me", "spam"));

SELECT Message, AES_DECRYPT(Message, "spam") FROM Testing

Perhaps your PHP might be incorrect and is actually setting all but the
first row to blank (which encrypted will look like a bona fide string)???

Anyhoo, if you want the MySQL guys to have a look at it you should
supply them with your MySQL version and you should create a test case
that exposes the bug using only SQL.

If you'd like me to look at your PHP then feel free to send it too me
(you might want to do that directly rather than to the list or you might
incur the wroth of the MySQL men :-))

Cheers,

Paul.



Sapenov wrote:

>Hi all,
>
>I have problem with fetching records to php script.
>
>table structure :
>-----------------------
>id int(10)
>message text
>----------------------
>
>i place information into message field using following query
>
>INSERT INTO table (message) VALUES (AES_ENCRYPT('$message','password'));
>
>it works fine, as i see in mysqlcc
>
>However, when I fire this query up both in php script and mysqlcc:
>
>SELECT AES_DECRYPT(message,'password'),message FROM CRM_tickets WHERE id='39'
>
>it outputs following information:
>
>----------------------------------------------------------- --------------------
>AES_DECRYPT(message,'password') | message
>----------------------------------------------------------- --------------------
>decrypted text | encrypted text
> | encrypted text
> | encrypted text
> | encrypted text
> | encrypted text
>
>----------------------------------------------------------- --------------------
>
>*looks like function works off only once*
>
>
>Regards,
>
>Khazret Sapenov
>Software Developer
>CMS Inc
>Toronto, Canada
>
>
>
>



--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org