MySQL 8.4 Reference Manual Including MySQL NDB Cluster 8.4

8.4.4.5 Using the component_keyring_encrypted_file Encrypted File-Based Keyring Component

Note

component_keyring_encrypted_file is an extension included in MySQL Enterprise Edition, a commercial product. To learn more about commercial products, see https://www.mysql.com/products/.

The component_keyring_encrypted_file keyring component stores keyring data in an encrypted, password-protected file local to the server host.

Warning

For encryption key management, the component_keyring_file and component_keyring_encrypted_file components are not intended as a regulatory compliance solution. Security standards such as PCI, FIPS, and others require use of key management systems to secure, manage, and protect encryption keys in key vaults or hardware security modules (HSMs).

To use component_keyring_encrypted_file for keystore management, you must:

  1. Write a manifest that tells the server to load component_keyring_encrypted_file, as described in Section 8.4.4.2, “Keyring Component Installation”.

  2. Write a configuration file for component_keyring_encrypted_file, as described here.

When it initializes, component_keyring_encrypted_file reads either a global configuration file, or a global configuration file paired with a local configuration file:

Local configuration files permit setting up multiple server instances to use component_keyring_encrypted_file, such that component configuration for each server instance is specific to a given data directory instance. This enables the same keyring component to be used with a distinct data file for each instance.

component_keyring_encrypted_file configuration files have these properties:

Given the preceding configuration file properties, to configure component_keyring_encrypted_file, create a global configuration file named component_keyring_encrypted_file.cnf in the directory where the component_keyring_encrypted_file library file is installed, and optionally create a local configuration file, also named component_keyring_encrypted_file.cnf, in the data directory. The following instructions assume that a keyring data file named /usr/local/mysql/keyring/component_keyring_encrypted_file is to be used in read/write fashion. You must also choose a password.

Keyring operations are transactional: component_keyring_encrypted_file uses a backup file during write operations to ensure that it can roll back to the original file if an operation fails. The backup file has the same name as the data file with a suffix of .backup.

component_keyring_encrypted_file supports the functions that comprise the standard MySQL Keyring service interface. Keyring operations performed by those functions are accessible in SQL statements as described in Section 8.4.4.12, “General-Purpose Keyring Key-Management Functions”.

Example:

SELECT keyring_key_generate('MyKey', 'AES', 32);
SELECT keyring_key_remove('MyKey');

For information about the characteristics of key values permitted by component_keyring_encrypted_file, see Section 8.4.4.10, “Supported Keyring Key Types and Lengths”.