Bug #4260 AES_DECRYPT() works only one time

Submitted: 23 Jun 2004 17:15 Modified: 23 Jun 2004 22:32
Reporter: Khazret Sapenov Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.20 OS:FreeBSD (FreeBSD 4.7)
Assigned to: Matthew Lord CPU Architecture:Any

[23 Jun 2004 17:15] Khazret Sapenov
Description:
mysql> status;
--------------
mysql  Ver 12.22 Distrib 4.0.20, for portbld-freebsd4.7 (i386)

Connection id:          59243
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          more
Using outfile:          ''
Server version:         4.0.14-standard
Protocol version:       10
Connection:             Localhost via UNIX socket
Client characterset:    latin1
Server characterset:    latin1
UNIX socket:            /tmp/mysql.sock
Uptime:                 35 days 47 min 9 sec

Threads: 7  Questions: 1343425  Slow queries: 3  Opens: 12313  Flush tables: 1  Open tables: 64  Queries per second avg: 0.444
--------------

mysql> describe CRM_tickets;
+------------------------+------------------+------+-----+---------+----------------+
| Field                  | Type             | Null | Key | Default | Extra          |
+------------------------+------------------+------+-----+---------+----------------+
| id_main                | int(10) unsigned |      | PRI | NULL    | auto_increment |
| id_parent              | int(11) unsigned |      |     | 0       |                |
| id_child               | int(11) unsigned |      |     | 0       |                |
| id_client              | int(11)          | YES  |     | NULL    |                |
| id_consultant          | int(11)          | YES  |     | NULL    |                |
| status                 | int(11)          | YES  |     | NULL    |                |
| date_opened            | date             | YES  |     | NULL    |                |
| date_closed            | date             | YES  |     | NULL    |                |
| subject                | varchar(50)      | YES  |     | NULL    |                |
| pay_status             | int(11) unsigned |      |     | 0       |                |
| message                | text             | YES  |     | NULL    |                |
| estimated_waiting_time | int(11)          | YES  |     | NULL    |                |
+------------------------+------------------+------+-----+---------+----------------+

This table supposed to store encrypted messages and decrypt it upon request.
However it displays only first record decrypted and NULL for the rest.

How to repeat:

INSERT INTO CRM_tickets(message,date_opened) VALUES(AES_ENCRYPT('$message','password'),NOW()) ;

/// create several records for testing purposes, then try to display it

SELECT date_opened, message, AES_DECRYPT(message,'password') as message2 FROM CRM_tickets ;

	

Suggested fix:
no idea
[23 Jun 2004 22:32] Matthew Lord
Hi Khazret,

I couldn't repeat this on FreeBSD 4.7.

mysql>create table aes (data varchar(255));

mysql>insert into aes values (aes_encrypt('woohoo', 'mypass')), (aes_encrypt('woohoo2', 'mypass')), 
(aes_encrypt('woohoo3', 'mypass')), (aes_encrypt('woohoo4', 'mypass')), (aes_encrypt('woohoo5', 
'mypass'));

mysql>select aes_decrypt(data, 'mypass') from aes;
+-----------------------------+
| aes_decrypt(data, 'mypass') |
+-----------------------------+
| woohoo                      |
| woohoo2                     |
| woohoo3                     |
| woohoo4                     |
| woohoo5                     |
+-----------------------------+
5 rows in set (0.02 sec)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.076 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.