| 1 |
# ---------------------------------------------------------------------- |
| 2 |
# Setup |
| 3 |
# Creating local configuration file for keyring component: component_keyring_file |
| 4 |
# Creating manifest file for current MySQL server instance |
| 5 |
# Re-starting mysql server with manifest file |
| 6 |
# ---------------------------------------------------------------------- |
| 7 |
# |
| 8 |
# WL#12261 Control (enforce and disable) table encryption |
| 9 |
# |
| 10 |
# Check for use of ENCRYPTION clause on tables using engines that |
| 11 |
# does not support encryption. |
| 12 |
# |
| 13 |
# 1. Requesting encryption on SE that does not support encryption. |
| 14 |
# |
| 15 |
CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='y'; |
| 16 |
ERROR 42000: The storage engine for the table doesn't support ENCRYPTION |
| 17 |
CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION='y'; |
| 18 |
ERROR 42000: The storage engine for the table doesn't support ENCRYPTION |
| 19 |
CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION='w'; |
| 20 |
ERROR 42000: The storage engine for the table doesn't support ENCRYPTION |
| 21 |
# 2. |
| 22 |
# Requesting unencrypted tables on SE that does not support |
| 23 |
# encryption. This is allowed. Verify that we do not store |
| 24 |
# ENCRYPTION clause. |
| 25 |
# |
| 26 |
CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='N'; |
| 27 |
SHOW CREATE TABLE t1; |
| 28 |
Table Create Table |
| 29 |
t1 CREATE TABLE `t1` ( |
| 30 |
`f1` int NOT NULL |
| 31 |
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 32 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 33 |
WHERE TABLE_NAME='t1'; |
| 34 |
TABLE_NAME CREATE_OPTIONS |
| 35 |
t1 |
| 36 |
DROP TABLE t1; |
| 37 |
CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=HEAP ENCRYPTION='n'; |
| 38 |
SHOW CREATE TABLE t1; |
| 39 |
Table Create Table |
| 40 |
t1 CREATE TABLE `t1` ( |
| 41 |
`f1` int NOT NULL |
| 42 |
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 43 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 44 |
WHERE TABLE_NAME='t1'; |
| 45 |
TABLE_NAME CREATE_OPTIONS |
| 46 |
t1 |
| 47 |
DROP TABLE t1; |
| 48 |
CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=MyISAM ENCRYPTION=''; |
| 49 |
SHOW CREATE TABLE t1; |
| 50 |
Table Create Table |
| 51 |
t1 CREATE TABLE `t1` ( |
| 52 |
`f1` int NOT NULL |
| 53 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 54 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 55 |
WHERE TABLE_NAME='t1'; |
| 56 |
TABLE_NAME CREATE_OPTIONS |
| 57 |
t1 |
| 58 |
DROP TABLE t1; |
| 59 |
# 3. |
| 60 |
# Move tables to and from different storage engine. |
| 61 |
# |
| 62 |
CREATE TABLE t1 (f1 INT NOT NULL) ENGINE=InnoDB ENCRYPTION='y'; |
| 63 |
SHOW CREATE TABLE t1; |
| 64 |
Table Create Table |
| 65 |
t1 CREATE TABLE `t1` ( |
| 66 |
`f1` int NOT NULL |
| 67 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' |
| 68 |
# 4. |
| 69 |
# Moving encrypted table to SE that doesn't support encryption. |
| 70 |
ALTER TABLE t1 ENGINE=MyISAM; |
| 71 |
ERROR 42000: The storage engine for the table doesn't support ENCRYPTION |
| 72 |
ALTER TABLE t1 ENGINE=HEAP; |
| 73 |
ERROR 42000: The storage engine for the table doesn't support ENCRYPTION |
| 74 |
# 5. |
| 75 |
# Moving encrypted table to SE that doesn't support encryption. |
| 76 |
# with a explicit request to decrypt the table is allowed. |
| 77 |
ALTER TABLE t1 ENGINE=MyISAM ENCRYPTION='n'; |
| 78 |
SHOW CREATE TABLE t1; |
| 79 |
Table Create Table |
| 80 |
t1 CREATE TABLE `t1` ( |
| 81 |
`f1` int NOT NULL |
| 82 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 83 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 84 |
WHERE TABLE_NAME='t1'; |
| 85 |
TABLE_NAME CREATE_OPTIONS |
| 86 |
t1 |
| 87 |
ALTER TABLE t1 ENGINE=Heap ENCRYPTION='N'; |
| 88 |
SHOW CREATE TABLE t1; |
| 89 |
Table Create Table |
| 90 |
t1 CREATE TABLE `t1` ( |
| 91 |
`f1` int NOT NULL |
| 92 |
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 93 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 94 |
WHERE TABLE_NAME='t1'; |
| 95 |
TABLE_NAME CREATE_OPTIONS |
| 96 |
t1 |
| 97 |
ALTER TABLE t1 ENGINE=CSV ENCRYPTION=''; |
| 98 |
SHOW CREATE TABLE t1; |
| 99 |
Table Create Table |
| 100 |
t1 CREATE TABLE `t1` ( |
| 101 |
`f1` int NOT NULL |
| 102 |
) ENGINE=CSV DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 103 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 104 |
WHERE TABLE_NAME='t1'; |
| 105 |
TABLE_NAME CREATE_OPTIONS |
| 106 |
t1 |
| 107 |
# 6. |
| 108 |
# Moving unencrypted table from SE that doesn't support encryption |
| 109 |
# to SE that does support encryption is allowed. |
| 110 |
ALTER TABLE t1 ENGINE=InnoDB ENCRYPTION='y'; |
| 111 |
SHOW CREATE TABLE t1; |
| 112 |
Table Create Table |
| 113 |
t1 CREATE TABLE `t1` ( |
| 114 |
`f1` int NOT NULL |
| 115 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' |
| 116 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 117 |
WHERE TABLE_NAME='t1'; |
| 118 |
TABLE_NAME CREATE_OPTIONS |
| 119 |
t1 ENCRYPTION='y' |
| 120 |
DROP TABLE t1; |
| 121 |
# Same as 4/5/6 using general tablespace: |
| 122 |
# |
| 123 |
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENCRYPTION='y'; |
| 124 |
CREATE TABLE t1 (f1 INT NOT NULL) TABLESPACE=ts1 ENCRYPTION='y'; |
| 125 |
# 4. |
| 126 |
# Moving encrypted table to SE that doesn't support encryption. |
| 127 |
ALTER TABLE t1 ENGINE=MyISAM; |
| 128 |
ERROR 42000: The storage engine for the table doesn't support ENCRYPTION |
| 129 |
ALTER TABLE t1 ENGINE=HEAP; |
| 130 |
ERROR 42000: The storage engine for the table doesn't support ENCRYPTION |
| 131 |
# 5. |
| 132 |
# Moving encrypted table to SE that doesn't support encryption. |
| 133 |
# with a explicit request to decrypt the table is allowed. |
| 134 |
ALTER TABLE t1 ENGINE=MyISAM ENCRYPTION='n'; |
| 135 |
SHOW CREATE TABLE t1; |
| 136 |
Table Create Table |
| 137 |
t1 CREATE TABLE `t1` ( |
| 138 |
`f1` int NOT NULL |
| 139 |
) /*!50100 TABLESPACE `ts1` */ ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 140 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 141 |
WHERE TABLE_NAME='t1'; |
| 142 |
TABLE_NAME CREATE_OPTIONS |
| 143 |
t1 |
| 144 |
# 6. |
| 145 |
# Moving unencrypted table from SE that doesn't support encryption |
| 146 |
# to SE that does support encryption is allowed. |
| 147 |
ALTER TABLE t1 ENGINE=InnoDB TABLESPACE=innodb_file_per_table ENCRYPTION='n'; |
| 148 |
SHOW CREATE TABLE t1; |
| 149 |
Table Create Table |
| 150 |
t1 CREATE TABLE `t1` ( |
| 151 |
`f1` int NOT NULL |
| 152 |
) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 153 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 154 |
WHERE TABLE_NAME='t1'; |
| 155 |
TABLE_NAME CREATE_OPTIONS |
| 156 |
t1 |
| 157 |
ALTER TABLE t1 ENCRYPTION='y'; |
| 158 |
SHOW CREATE TABLE t1; |
| 159 |
Table Create Table |
| 160 |
t1 CREATE TABLE `t1` ( |
| 161 |
`f1` int NOT NULL |
| 162 |
) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' |
| 163 |
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES |
| 164 |
WHERE TABLE_NAME='t1'; |
| 165 |
TABLE_NAME CREATE_OPTIONS |
| 166 |
t1 ENCRYPTION='y' |
| 167 |
DROP TABLE t1; |
| 168 |
DROP TABLESPACE ts1; |
| 169 |
# ---------------------------------------------------------------------- |
| 170 |
# Teardown |
| 171 |
# Removing manifest file for current MySQL server instance |
| 172 |
# Removing local keyring file for keyring component: component_keyring_file |
| 173 |
# Removing local configuration file for keyring component: component_keyring_file |
| 174 |
# Restarting server without the manifest file |
| 175 |
# ---------------------------------------------------------------------- |