>Description:
aes_encrypt/aes_decrypt works correctly for a test case. Change only
the last two digits of the string needing to be encrypted and
it returns null.
I formed the queries below by cut and paste, so I was sure that the
password was constant. The actual problem occured when my C program,
using a server side password that was not altered during execution,
would work correctly for 55 insert statements and have an error on one.
As I was about to send this, I repeated the test except for changing
the key to "gary". Everything worked then.
Linux/Red Hat Version 8.0
Tested on 4.0.2-alpha-log and 4.0.10-gamma-standard
>How-To-Repeat:
mysql> describe sop_uid;
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| sop_uid | varchar(150) | YES | | NULL | |
| case_id | int(11) | YES | | NULL | |
| study_id | int(11) | YES | | NULL | |
| series_id | int(11) | YES | | NULL | |
| unique_number | int(11) | YES | | NULL | |
+---------------+--------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
mysql> delete from sop_uid;
Query OK, 3 rows affected (0.00 sec)
mysql> INSERT INTO sop_uid ( sop_uid, case_id, study_id, series_id, unique_number )
-> VALUES ( AES_ENCRYPT("1.2.840.113619.2.55.1.1762891793.2470.1041939826.111",
"titepfda"), 46, 130, 603, 113177);
Query OK, 1 row affected (0.00 sec)
mysql> select aes_decrypt(sop_uid, "titepfda"),
case_id,study_id,series_id,unique_number from sop_uid where unique_number=113177;
+------------------------------------------------------+---------+----------+-----------+---------------+
| aes_decrypt(sop_uid, "titepfda") | case_id | study_id |
|series_id | unique_number |
+------------------------------------------------------+---------+----------+-----------+---------------+
| 1.2.840.113619.2.55.1.1762891793.2470.1041939826.111 | 46 | 130 |
|603 | 113177 |
+------------------------------------------------------+---------+----------+-----------+---------------+
1 row in set (0.00 sec)
mysql> INSERT INTO sop_uid ( sop_uid, case_id, study_id, series_id, unique_number )
-> VALUES ( AES_ENCRYPT("1.2.840.113619.2.55.1.1762891793.2470.1041939826.158",
"titepfda"), 46, 130, 603, 113177);
Query OK, 1 row affected (0.00 sec)
mysql> select aes_decrypt(sop_uid, "titepfda"),
case_id,study_id,series_id,unique_number from sop_uid where unique_number=113177;
+------------------------------------------------------+---------+----------+-----------+---------------+
| aes_decrypt(sop_uid, "titepfda") | case_id | study_id |
|series_id | unique_number |
+------------------------------------------------------+---------+----------+-----------+---------------+
| 1.2.840.113619.2.55.1.1762891793.2470.1041939826.111 | 46 | 130 |
|603 | 113177 |
| NULL | 46 | 130 |
|603 | 113177 |
+------------------------------------------------------+---------+----------+-----------+---------------+
2 rows in set (0.00 sec)
mysql> select version();
+-----------------------+
| version() |
+-----------------------+
| 4.0.10-gamma-standard |
+-----------------------+
1 row in set (0.00 sec)
>Fix:
>Submitter-Id: <submitter ID>
>Originator:
>Organization:
>MySQL support: none
>Synopsis: aes_encrypt/aes_decrypt returns null for correct input data
>Severity:
>Priority:
>Category: mysql
>Class:
>Release: mysql-4.0.10-gamma-standard (Official MySQL-standard binary)
>C compiler: 2.95.3
>C++ compiler: 2.95.3
>Environment:
System: Linux gary.rad.med.umich.edu 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686
i686 i386 GNU/Linux
Architecture: i686
Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking
--host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Compilation info: CC='gcc' CFLAGS='-O2 -mcpu=pentiumpro' CXX='gcc' CXXFLAGS='-O2
-mcpu=pentiumpro -felide-constructors' LDFLAGS='' ASFLAGS=''
LIBC:
lrwxrwxrwx 1 root root 14 Oct 15 11:24 /lib/libc.so.6 ->
libc-2.2.93.so
-rwxr-xr-x 1 root root 1235468 Sep 5 19:12 /lib/libc-2.2.93.so
-rw-r--r-- 1 root root 2233342 Sep 5 18:59 /usr/lib/libc.a
-rw-r--r-- 1 root root 178 Sep 5 18:50 /usr/lib/libc.so
Configure command: ./configure '--prefix=/usr/local/mysql' '--with-comment=Official
MySQL-standard binary' '--with-extra-charsets=complex'
'--with-server-suffix=-standard' '--enable-thread-safe-client' '--enable-local-infile'
'--enable-assembler' '--disable-shared' '--with-client-ldflags=-all-static'
'--with-mysqld-ldflags=-all-static' '--with-innodb' 'CFLAGS=-O2 -mcpu=pentiumpro'
'CXXFLAGS=-O2 -mcpu=pentiumpro -felide-constructors' 'CXX=gcc'
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php