mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-27104 deprecate DES_ENCRYPT/DECRYPT functions
This commit is contained in:
parent
90c3b2835d
commit
fe8b99dd5c
9 changed files with 266 additions and 18 deletions
|
@ -1,12 +1,16 @@
|
|||
select des_encrypt('hello');
|
||||
des_encrypt('hello')
|
||||
€Ö2nV“Ø}
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
#
|
||||
# Bug #11643: des_encrypt() causes server to die
|
||||
#
|
||||
CREATE TABLE t1 (des VARBINARY(200) NOT NULL DEFAULT '') ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('1234'), ('12345'), ('123456'), ('1234567');
|
||||
UPDATE t1 SET des=DES_ENCRYPT('1234');
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
SELECT LENGTH(des) FROM t1;
|
||||
LENGTH(des)
|
||||
9
|
||||
|
@ -19,6 +23,8 @@ DES_DECRYPT(des)
|
|||
1234
|
||||
1234
|
||||
1234
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
SELECT
|
||||
LENGTH(DES_ENCRYPT('1234')),
|
||||
LENGTH(DES_ENCRYPT('12345')),
|
||||
|
@ -26,6 +32,11 @@ LENGTH(DES_ENCRYPT('123456')),
|
|||
LENGTH(DES_ENCRYPT('1234567'));
|
||||
LENGTH(DES_ENCRYPT('1234')) LENGTH(DES_ENCRYPT('12345')) LENGTH(DES_ENCRYPT('123456')) LENGTH(DES_ENCRYPT('1234567'))
|
||||
9 9 9 9
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
SELECT
|
||||
DES_DECRYPT(DES_ENCRYPT('1234')),
|
||||
DES_DECRYPT(DES_ENCRYPT('12345')),
|
||||
|
@ -33,6 +44,15 @@ DES_DECRYPT(DES_ENCRYPT('123456')),
|
|||
DES_DECRYPT(DES_ENCRYPT('1234567'));
|
||||
DES_DECRYPT(DES_ENCRYPT('1234')) DES_DECRYPT(DES_ENCRYPT('12345')) DES_DECRYPT(DES_ENCRYPT('123456')) DES_DECRYPT(DES_ENCRYPT('1234567'))
|
||||
1234 12345 123456 1234567
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
|
@ -64,6 +84,8 @@ i NULL
|
|||
j 000000000009
|
||||
j NULL
|
||||
NULL NULL
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT t1 VALUES (1),(2);
|
||||
|
@ -71,5 +93,20 @@ SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS
|
|||
CHAR_LENGTH(a) DES_DECRYPT(a)
|
||||
1 ¢
|
||||
1 ¢
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
DROP TABLE t1;
|
||||
End of 10.5 tests
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-27104 deprecate DES_ENCRYPT/DECRYPT functions
|
||||
#
|
||||
# just show how to disable deprecation note
|
||||
set sql_notes=0;
|
||||
select hex(des_encrypt('a'));
|
||||
hex(des_encrypt('a'))
|
||||
80E4DE4136BA6CD7F3
|
||||
#
|
||||
# End of 10.10 tests
|
||||
#
|
||||
|
|
|
@ -57,4 +57,17 @@ INSERT t1 VALUES (1),(2);
|
|||
SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
--Echo End of 10.5 tests
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-27104 deprecate DES_ENCRYPT/DECRYPT functions
|
||||
--echo #
|
||||
--echo # just show how to disable deprecation note
|
||||
set sql_notes=0;
|
||||
select hex(des_encrypt('a'));
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.10 tests
|
||||
--echo #
|
||||
|
|
|
@ -1,45 +1,125 @@
|
|||
drop table if exists t1;
|
||||
create table t1 (x blob);
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('a','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','a'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('ab','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','ab'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abc','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abc'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abcd','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcd'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abcde','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcde'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abcdef','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdef'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abcdefg','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefg'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abcdefgh','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefgh'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abcdefghi','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghi'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abcdefghij','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghij'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('abcdefghijk','The quick red fox jumped over the lazy brown dog'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghijk'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('quick red fox jumped over the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('red fox jumped over the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('fox jumped over the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('over the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('dog!','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('dog!!','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('dog!!!','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('dog!!!!','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('dog!!!!!','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
select hex(x), hex(des_decrypt(x,'sabakala')) from t1;
|
||||
hex(x) hex(des_decrypt(x,'sabakala'))
|
||||
FFA185A4656D113445E31D7A5B31BB57671A4CA9E21E63FE5D9C801E0CC7AA6190C13E269C2AE8D8060D3FB3FEA94FEC7FB006B9DCAC3E3E41 NULL
|
||||
|
@ -82,6 +162,8 @@ FF3FC2E42D7C840905 646F6721212121
|
|||
FF9723312D26D9E6DA01D01A784A64DB9D 646F672121212121
|
||||
FF8333F3DD21E4488F967E03DD12394813A49F72848BB49473D3CB1C8A1AACF220 6A756D706564206F76657220746865206C617A792062726F776E20646F67
|
||||
FF8333F3DD21E4488F967E03DD12394813A49F72848BB49473D3CB1C8A1AACF220 6A756D706564206F76657220746865206C617A792062726F776E20646F67
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(x,'sabakala') as s from t1 having s like '%dog%';
|
||||
s
|
||||
The quick red fox jumped over the lazy brown dog
|
||||
|
@ -101,87 +183,145 @@ dog!!!!
|
|||
dog!!!!!
|
||||
jumped over the lazy brown dog
|
||||
jumped over the lazy brown dog
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
drop table t1;
|
||||
select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello"));
|
||||
hex(des_encrypt("hello")) des_decrypt(des_encrypt("hello"))
|
||||
85D6DC8859F9759BBB hello
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(des_encrypt("hello",4));
|
||||
des_decrypt(des_encrypt("hello",4))
|
||||
hello
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(des_encrypt("hello",'test'),'test');
|
||||
des_decrypt(des_encrypt("hello",'test'),'test')
|
||||
hello
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password'));
|
||||
hex(des_encrypt("hello")) hex(des_encrypt("hello",5)) hex(des_encrypt("hello",'default_password'))
|
||||
85D6DC8859F9759BBB 85D6DC8859F9759BBB FFD6DC8859F9759BBB
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(des_encrypt("hello"),'default_password');
|
||||
des_decrypt(des_encrypt("hello"),'default_password')
|
||||
hello
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(des_encrypt("hello",4),'password4');
|
||||
des_decrypt(des_encrypt("hello",4),'password4')
|
||||
hello
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_encrypt("hello",10);
|
||||
des_encrypt("hello",10)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1108 Incorrect parameters to procedure 'des_encrypt'
|
||||
select des_encrypt(NULL);
|
||||
des_encrypt(NULL)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
select des_encrypt(NULL, 10);
|
||||
des_encrypt(NULL, 10)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
select des_encrypt(NULL, NULL);
|
||||
des_encrypt(NULL, NULL)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
select des_encrypt(10, NULL);
|
||||
des_encrypt(10, NULL)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1108 Incorrect parameters to procedure 'des_encrypt'
|
||||
select des_encrypt("hello", NULL);
|
||||
des_encrypt("hello", NULL)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1108 Incorrect parameters to procedure 'des_encrypt'
|
||||
select des_decrypt("hello",10);
|
||||
des_decrypt("hello",10)
|
||||
hello
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(NULL);
|
||||
des_decrypt(NULL)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(NULL, 10);
|
||||
des_decrypt(NULL, 10)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(NULL, NULL);
|
||||
des_decrypt(NULL, NULL)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt(10, NULL);
|
||||
des_decrypt(10, NULL)
|
||||
10
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select des_decrypt("hello", NULL);
|
||||
des_decrypt("hello", NULL)
|
||||
hello
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
SET @a=des_decrypt(des_encrypt("hello"));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
flush des_key_file;
|
||||
select @a = des_decrypt(des_encrypt("hello"));
|
||||
@a = des_decrypt(des_encrypt("hello"))
|
||||
1
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select hex("hello");
|
||||
hex("hello")
|
||||
68656C6C6F
|
||||
select hex(des_decrypt(des_encrypt("hello",4),'password2'));
|
||||
hex(des_decrypt(des_encrypt("hello",4),'password2'))
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select hex(des_decrypt(des_encrypt("hello","hidden")));
|
||||
hex(des_decrypt(des_encrypt("hello","hidden")))
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1108 Incorrect parameters to procedure 'des_decrypt'
|
||||
explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Note 1003 select des_decrypt(des_encrypt('hello',4),'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt('hello','hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
|
||||
#
|
||||
# Start of 10.1 tests
|
||||
|
@ -196,6 +336,7 @@ SELECT * FROM t1 WHERE a=1 AND DES_ENCRYPT('test',a)=_latin1 'abc' COLLATE latin
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and des_encrypt('test',`test`.`t1`.`a`) = 'abc'
|
||||
DROP TABLE t1;
|
||||
#
|
||||
|
@ -212,6 +353,9 @@ a VARCHAR(30),
|
|||
b BLOB DEFAULT DES_ENCRYPT(a, 'passwd'),
|
||||
c TEXT DEFAULT DES_DECRYPT(b, 'passwd')
|
||||
);
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
|
|
|
@ -120,7 +120,9 @@ CREATE TABLE t1 (
|
|||
b BLOB DEFAULT DES_ENCRYPT(a, 'passwd'),
|
||||
c TEXT DEFAULT DES_DECRYPT(b, 'passwd')
|
||||
);
|
||||
--disable_warnings
|
||||
SHOW CREATE TABLE t1;
|
||||
--enable_warnings
|
||||
INSERT INTO t1 (a) VALUES ('test');
|
||||
SELECT c FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -2,67 +2,87 @@ select des_encrypt("test", 'akeystr');
|
|||
des_encrypt("test", 'akeystr')
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_encrypt("test", 1);
|
||||
des_encrypt("test", 1)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_encrypt("test", 9);
|
||||
des_encrypt("test", 9)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_encrypt("test", 100);
|
||||
des_encrypt("test", 100)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_encrypt("test", NULL);
|
||||
des_encrypt("test", NULL)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_encrypt(NULL, NULL);
|
||||
des_encrypt(NULL, NULL)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_decrypt("test", 'anotherkeystr');
|
||||
des_decrypt("test", 'anotherkeystr')
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_decrypt(1, 1);
|
||||
des_decrypt(1, 1)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_decrypt(des_encrypt("test", 'thekey'));
|
||||
des_decrypt(des_encrypt("test", 'thekey'))
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello"));
|
||||
hex(des_encrypt("hello")) des_decrypt(des_encrypt("hello"))
|
||||
NULL NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_decrypt(des_encrypt("hello",4));
|
||||
des_decrypt(des_encrypt("hello",4))
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_decrypt(des_encrypt("hello",'test'),'test');
|
||||
des_decrypt(des_encrypt("hello",'test'),'test')
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password'));
|
||||
hex(des_encrypt("hello")) hex(des_encrypt("hello",5)) hex(des_encrypt("hello",'default_password'))
|
||||
NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
|
@ -70,19 +90,28 @@ select des_decrypt(des_encrypt("hello"),'default_password');
|
|||
des_decrypt(des_encrypt("hello"),'default_password')
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select des_decrypt(des_encrypt("hello",4),'password4');
|
||||
des_decrypt(des_encrypt("hello",4),'password4')
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
SET @a=des_decrypt(des_encrypt("hello"));
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
flush des_key_file;
|
||||
select @a = des_decrypt(des_encrypt("hello"));
|
||||
@a = des_decrypt(des_encrypt("hello"))
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
select hex("hello");
|
||||
hex("hello")
|
||||
68656C6C6F
|
||||
|
@ -90,9 +119,13 @@ select hex(des_decrypt(des_encrypt("hello",4),'password2'));
|
|||
hex(des_decrypt(des_encrypt("hello",4),'password2'))
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
select hex(des_decrypt(des_encrypt("hello","hidden")));
|
||||
hex(des_decrypt(des_encrypt("hello","hidden")))
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
|
||||
|
|
|
@ -4,16 +4,22 @@
|
|||
SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)));
|
||||
CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)))
|
||||
9
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED);
|
||||
CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED)
|
||||
0
|
||||
Warnings:
|
||||
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
|
||||
Warning 1292 Truncated incorrect INTEGER value: '\xFFT\xDCiK\x92j\xE6\xFC'
|
||||
SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)));
|
||||
CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)))
|
||||
4
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED);
|
||||
CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED)
|
||||
0
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'test'
|
||||
|
|
|
@ -5,4 +5,6 @@ convert((SELECT des_decrypt(2,1) AS a FROM t1 WHERE @a:=1), signed) as d
|
|||
FROM t1 ;
|
||||
d
|
||||
2
|
||||
Warnings:
|
||||
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -733,6 +733,17 @@ bool Item_func_concat::fix_length_and_dec(THD *thd)
|
|||
Encryption result is longer than original by formula:
|
||||
@code new_length= org_length + (8-(org_length % 8))+1 @endcode
|
||||
*/
|
||||
bool Item_func_des_encrypt::fix_length_and_dec(THD *thd)
|
||||
{
|
||||
set_maybe_null();
|
||||
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
|
||||
max_length = args[0]->max_length + 9;
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_WARN_DEPRECATED_SYNTAX,
|
||||
ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
|
||||
func_name_cstring().str);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
String *Item_func_des_encrypt::val_str(String *str)
|
||||
{
|
||||
|
@ -833,6 +844,20 @@ error:
|
|||
}
|
||||
|
||||
|
||||
bool Item_func_des_decrypt::fix_length_and_dec(THD *thd)
|
||||
{
|
||||
set_maybe_null();
|
||||
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
|
||||
max_length= args[0]->max_length;
|
||||
if (max_length >= 9U)
|
||||
max_length-= 9U;
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_WARN_DEPRECATED_SYNTAX,
|
||||
ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
|
||||
func_name_cstring().str);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
String *Item_func_des_decrypt::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed());
|
||||
|
|
|
@ -897,13 +897,7 @@ public:
|
|||
Item_func_des_encrypt(THD *thd, Item *a, Item *b)
|
||||
:Item_str_binary_checksum_func(thd, a, b) {}
|
||||
String *val_str(String *) override;
|
||||
bool fix_length_and_dec(THD *thd) override
|
||||
{
|
||||
set_maybe_null();
|
||||
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
|
||||
max_length = args[0]->max_length + 9;
|
||||
return FALSE;
|
||||
}
|
||||
bool fix_length_and_dec(THD *thd) override;
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("des_encrypt") };
|
||||
|
@ -922,15 +916,7 @@ public:
|
|||
Item_func_des_decrypt(THD *thd, Item *a, Item *b)
|
||||
:Item_str_binary_checksum_func(thd, a, b) {}
|
||||
String *val_str(String *) override;
|
||||
bool fix_length_and_dec(THD *thd) override
|
||||
{
|
||||
set_maybe_null();
|
||||
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
|
||||
max_length= args[0]->max_length;
|
||||
if (max_length >= 9U)
|
||||
max_length-= 9U;
|
||||
return FALSE;
|
||||
}
|
||||
bool fix_length_and_dec(THD *thd) override;
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("des_decrypt") };
|
||||
|
|
Loading…
Add table
Reference in a new issue