mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
a63ecdd3b1
New HEX() function. Final (?) cleanup of des_encrypt() / des_decrypt(). Added missing files to Makefiles. Docs/Makefile.am: Add missing files Docs/manual.texi: Added information about HEX() and des_encrypt() / des_decrypt(). include/mysql_com.h: Added FLUSH DES_KEY_FILE myisam/ft_update.c: Removed compiler warnings mysql-test/mysql-test-run.sh: Fixes needed for des_key tests. mysql-test/r/func_crypt.result: Moved crypt test from func_str to func_crypt mysql-test/r/func_encrypt.result: Moved crypt test from func_str to func_crypt mysql-test/r/func_str.result: Moved crypt test from func_str to func_crypt mysql-test/t/func_crypt.test: Moved crypt test from func_str to func_crypt mysql-test/t/func_encrypt.test: New tests mysql-test/t/func_str.test: Moved crypt test from func_str to func_crypt sql/des_key_file.cc: Changes needed for FLUSH DES_KEY_FILE sql/item_create.cc: New HEX() function sql/item_strfunc.cc: Changes needed for FLUSH DES_KEY_FILE sql/item_strfunc.h: New HEX() function sql/item_timefunc.cc: cleanup sql/lex.h: FLUSH DES_KEY_FILE sql/mysql_priv.h: FLUSH DES_KEY_FILE sql/mysqld.cc: FLUSH DES_KEY_FILE sql/sql_parse.cc: Cleanup sql_yacc.yy sql/sql_yacc.yy: Cleanup sql_yacc.yy
67 lines
4.4 KiB
Text
67 lines
4.4 KiB
Text
-- source include/have_openssl.inc
|
|
|
|
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'));
|
|
insert into t1 values (des_encrypt('a','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','a'));
|
|
insert into t1 values (des_encrypt('ab','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','ab'));
|
|
insert into t1 values (des_encrypt('abc','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abc'));
|
|
insert into t1 values (des_encrypt('abcd','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcd'));
|
|
insert into t1 values (des_encrypt('abcde','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcde'));
|
|
insert into t1 values (des_encrypt('abcdef','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdef'));
|
|
insert into t1 values (des_encrypt('abcdefg','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefg'));
|
|
insert into t1 values (des_encrypt('abcdefgh','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefgh'));
|
|
insert into t1 values (des_encrypt('abcdefghi','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghi'));
|
|
insert into t1 values (des_encrypt('abcdefghij','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghij'));
|
|
insert into t1 values (des_encrypt('abcdefghijk','The quick red fox jumped over the lazy brown dog'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghijk'));
|
|
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('quick red fox jumped over the lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('red fox jumped over the lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('fox jumped over the lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('over the lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('the lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('dog','sabakala'));
|
|
insert into t1 values (des_encrypt('dog!','sabakala'));
|
|
insert into t1 values (des_encrypt('dog!!','sabakala'));
|
|
insert into t1 values (des_encrypt('dog!!!','sabakala'));
|
|
insert into t1 values (des_encrypt('dog!!!!','sabakala'));
|
|
insert into t1 values (des_encrypt('dog!!!!!','sabakala'));
|
|
insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
|
|
insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
|
|
select hex(x), hex(des_decrypt(x,'sabakala')) from t1;
|
|
select des_decrypt(x,'sabakala') as s from t1 having s like '%dog%';
|
|
drop table t1;
|
|
|
|
#
|
|
# Test default keys
|
|
#
|
|
select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello"));
|
|
select des_decrypt(des_encrypt("hello",4));
|
|
select des_decrypt(des_encrypt("hello",'test'),'test');
|
|
select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password'));
|
|
select des_decrypt(des_encrypt("hello"),'default_password');
|
|
select des_decrypt(des_encrypt("hello",4),'password4');
|
|
|
|
# Test flush
|
|
SET @a=des_decrypt(des_encrypt("hello"));
|
|
flush des_key_file;
|
|
select @a = des_decrypt(des_encrypt("hello"));
|
|
|
|
# Test usage of wrong password
|
|
select hex("hello");
|
|
select hex(des_decrypt(des_encrypt("hello",4),'password2'));
|
|
select hex(des_decrypt(des_encrypt("hello","hidden")));
|