1

Topic: Enciphering AES_ENCRYPT

Hello.
It is necessary to decrypt value.
How correctly to make it?
There is a table in basis:

CREATE TABLE t1 (
n BIGINT UNSIGNED NOT NULL AUTO_INCREMENT;
info TEXT NOT NULL;
PRIMARY KEY (n));

I try and it is impossible

;
AES_DECRYPT (SELECT info FROM t1 WHERE n =?, ' Secret ');

I interpose that though correctly?

INSERT INTO t1 VALUES (info, AES_ENCRYPT (' Secret info ', ' SecretKey '));

2

Re: Enciphering AES_ENCRYPT

Understood.
It is necessary SELECT in the beginning

SELECT AES_DECRYPT (SELECT info FROM t1 WHERE n =?, ' Secret ');

3

Re: Enciphering AES_ENCRYPT

Ostic;

SELECT AES_DECRYPT (info, ' SecretKey ') FROM t1 WHERE n = 123

?

4

Re: Enciphering AES_ENCRYPT

Ostic wrote:

I Interpose that though correctly?

INSERT INTO t1 VALUES (info, AES_ENCRYPT (' Secret info ', ' SecretKey '));
INSERT INTO ` t1 ` (` info `) VALUES (AES_ENCRYPT (' Secret info ', ' SecretKey '));

5

Re: Enciphering AES_ENCRYPT

And, yes, a field of type BLOB