mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
tests for file_key_management plugin key file parser
This commit is contained in:
BIN
mysql-test/suite/plugins/t/filekeys-data.enc
Normal file
BIN
mysql-test/suite/plugins/t/filekeys-data.enc
Normal file
Binary file not shown.
1
mysql-test/suite/plugins/t/filekeys-data.key
Normal file
1
mysql-test/suite/plugins/t/filekeys-data.key
Normal file
@ -0,0 +1 @@
|
||||
secret
|
18
mysql-test/suite/plugins/t/filekeys_badtest.inc
Normal file
18
mysql-test/suite/plugins/t/filekeys_badtest.inc
Normal file
@ -0,0 +1,18 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_xtradb.inc
|
||||
-- source filekeys_plugin.inc
|
||||
|
||||
--eval call mtr.add_suppression("$SEARCH_PATTERN")
|
||||
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
|
||||
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err
|
||||
--let SEARCH_RANGE= -10000
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb page_encryption=1 page_encryption_key=1;
|
||||
|
||||
select plugin_status from information_schema.plugins
|
||||
where plugin_name = 'file_key_management';
|
||||
|
2
mysql-test/suite/plugins/t/filekeys_encfile.opt
Normal file
2
mysql-test/suite/plugins/t/filekeys_encfile.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=secret
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
1
mysql-test/suite/plugins/t/filekeys_encfile.test
Normal file
1
mysql-test/suite/plugins/t/filekeys_encfile.test
Normal file
@ -0,0 +1 @@
|
||||
source filekeys_goodtest.inc;
|
2
mysql-test/suite/plugins/t/filekeys_encfile_bad.opt
Normal file
2
mysql-test/suite/plugins/t/filekeys_encfile_bad.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=bad
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
2
mysql-test/suite/plugins/t/filekeys_encfile_bad.test
Normal file
2
mysql-test/suite/plugins/t/filekeys_encfile_bad.test
Normal file
@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=Cannot decrypt .*filekeys-data.enc. Wrong key;
|
||||
source filekeys_badtest.inc;
|
2
mysql-test/suite/plugins/t/filekeys_encfile_badfile.opt
Normal file
2
mysql-test/suite/plugins/t/filekeys_encfile_badfile.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=FILE:bad
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
2
mysql-test/suite/plugins/t/filekeys_encfile_badfile.test
Normal file
2
mysql-test/suite/plugins/t/filekeys_encfile_badfile.test
Normal file
@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=File 'bad' not found;
|
||||
source filekeys_badtest.inc;
|
2
mysql-test/suite/plugins/t/filekeys_encfile_file.opt
Normal file
2
mysql-test/suite/plugins/t/filekeys_encfile_file.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/t/filekeys-data.key
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
1
mysql-test/suite/plugins/t/filekeys_encfile_file.test
Normal file
1
mysql-test/suite/plugins/t/filekeys_encfile_file.test
Normal file
@ -0,0 +1 @@
|
||||
source filekeys_goodtest.inc;
|
1
mysql-test/suite/plugins/t/filekeys_encfile_no.opt
Normal file
1
mysql-test/suite/plugins/t/filekeys_encfile_no.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
|
2
mysql-test/suite/plugins/t/filekeys_encfile_no.test
Normal file
2
mysql-test/suite/plugins/t/filekeys_encfile_no.test
Normal file
@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=Cannot decrypt .*filekeys-data.enc. Wrong key;
|
||||
source filekeys_badtest.inc;
|
20
mysql-test/suite/plugins/t/filekeys_goodtest.inc
Normal file
20
mysql-test/suite/plugins/t/filekeys_goodtest.inc
Normal file
@ -0,0 +1,20 @@
|
||||
-- source include/have_xtradb.inc
|
||||
-- source filekeys_plugin.inc
|
||||
|
||||
create table t1(c1 bigint not null, b char(200)) engine=innodb page_encryption=1 page_encryption_key=1;
|
||||
show create table t1;
|
||||
insert t1 values (12345, repeat('1234567890', 20));
|
||||
|
||||
alter table t1 page_encryption_key=2;
|
||||
show create table t1;
|
||||
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
alter table t1 page_encryption_key=3;
|
||||
show create table t1;
|
||||
alter table t1 page_encryption_key=33;
|
||||
show create table t1;
|
||||
alter table t1 page_encryption_key=4;
|
||||
show create table t1;
|
||||
|
||||
drop table t1;
|
||||
|
2
mysql-test/suite/plugins/t/filekeys_nofile.test
Normal file
2
mysql-test/suite/plugins/t/filekeys_nofile.test
Normal file
@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=File '' not found;
|
||||
source filekeys_badtest.inc;
|
4
mysql-test/suite/plugins/t/filekeys_plugin.inc
Normal file
4
mysql-test/suite/plugins/t/filekeys_plugin.inc
Normal file
@ -0,0 +1,4 @@
|
||||
if (!$FILE_KEY_MANAGEMENT_SO)
|
||||
{
|
||||
--skip Needs file_key_management
|
||||
}
|
2
mysql-test/suite/plugins/t/filekeys_plugin.opt
Normal file
2
mysql-test/suite/plugins/t/filekeys_plugin.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
|
||||
--encryption-algorithm=aes_cbc
|
1
mysql-test/suite/plugins/t/filekeys_syntax.opt
Normal file
1
mysql-test/suite/plugins/t/filekeys_syntax.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-file-key-management-filename=$MYSQL_TMP_DIR/keys.txt
|
96
mysql-test/suite/plugins/t/filekeys_syntax.test
Normal file
96
mysql-test/suite/plugins/t/filekeys_syntax.test
Normal file
@ -0,0 +1,96 @@
|
||||
#
|
||||
# first test - missing key file
|
||||
#
|
||||
let SEARCH_PATTERN=File '.*keys.txt' not found;
|
||||
source filekeys_badtest.inc;
|
||||
|
||||
#
|
||||
# key id= 0
|
||||
#
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
0;00000000000000000000000000000000
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Invalid key id;
|
||||
source filekeys_badtest.inc;
|
||||
|
||||
#
|
||||
# id too big
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
4294967299;00000000000000000000000000000000
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Invalid key id;
|
||||
source filekeys_badtest.inc;
|
||||
#
|
||||
# wrong key length (not 16, 24, 23 bytes)
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
3;00000000000000000000000000000000111122223333
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Invalid key;
|
||||
source filekeys_badtest.inc;
|
||||
#
|
||||
# wrong key length (not an even number of digits)
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
3;0000000000000000000000000000000
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Invalid key;
|
||||
source filekeys_badtest.inc;
|
||||
#
|
||||
# no semicolon
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
3:0000000000000000000000000000000
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Syntax error;
|
||||
source filekeys_badtest.inc;
|
||||
#
|
||||
# another syntax error
|
||||
#
|
||||
remove_file $MYSQL_TMP_DIR/keys.txt;
|
||||
write_file $MYSQL_TMP_DIR/keys.txt;
|
||||
1;11111111111111111111111111111111
|
||||
syntax error
|
||||
2;22222222222222222222222222222222
|
||||
EOF
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
--error 2
|
||||
install soname 'file_key_management';
|
||||
source filekeys_badtest.inc;
|
||||
let SEARCH_PATTERN=Syntax error;
|
||||
source filekeys_badtest.inc;
|
2
mysql-test/suite/plugins/t/filekeys_unencfile.opt
Normal file
2
mysql-test/suite/plugins/t/filekeys_unencfile.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--loose-file-key-management-filekey=bad
|
||||
--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
|
2
mysql-test/suite/plugins/t/filekeys_unencfile.test
Normal file
2
mysql-test/suite/plugins/t/filekeys_unencfile.test
Normal file
@ -0,0 +1,2 @@
|
||||
let SEARCH_PATTERN=Cannot decrypt .*keys.txt. Not encrypted;
|
||||
source filekeys_badtest.inc;
|
Reference in New Issue
Block a user