Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- Can't get aes encrypt to work


dowzer - 9:55 pm on Mar 1, 2011 (gmt 0)


I am trying to use AES_ENCRPYT to encrypt some sensitive data in a MySQL database which needs to be able to be decrypted to allow a user to update the data later.

I am using the below syntax in PHPMyAdmin initially but, while I get a 1 row(s) inserted message, the field value is blank - any idea what I am doing wrong?

INSERT INTO table (field_name) VALUES (AES_ENCRYPT('text','password'))

The table and field in question is configured as:

CREATE TABLE IF NOT EXISTS `table` (
`id` int(5) NOT NULL auto_increment,
`field_name` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=28 ;

I am using PHPMyAdmin version 3.3.9 with MySQL version 5.0.92 and PHP version: 5.2.6 on Linux.

Thanks
Jase


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4274904.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com