8.4.4.4 Using the component_keyring_file File-Based Keyring Component (original) (raw)

8.4.4.4 Using the component_keyring_file File-Based Keyring Component

The component_keyring_file keyring component stores keyring data in a file local to the server host.

Warning

For encryption key management, thecomponent_keyring_file andcomponent_keyring_encrypted_file components, and the keyring_file andkeyring_encrypted_file plugins 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_file for keystore management, you must:

  1. Write a manifest that tells the server to loadcomponent_keyring_file, as described inSection 8.4.4.2, “Keyring Component Installation”.
  2. Write a configuration file forcomponent_keyring_file, as described here.

When it initializes, component_keyring_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_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_file configuration files have these properties:

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

{  
  "path": "/usr/local/mysql/keyring/component_keyring_file",  
  "read_only": false  
}  

Create this file in the directory where thecomponent_keyring_file library file is installed.
Important
In MySQL 8.0.29 and later, it is not possible for this path to point to the MySQL data directory.

{  
  "read_local_config": true  
}  

Create this file in the directory where thecomponent_keyring_file library file is installed.
The local file looks like this:

{  
  "path": "/usr/local/mysql/keyring/component_keyring_file",  
  "read_only": false  
}  

Important
In MySQL 8.0.29 and later, it is not possible for this path to point to the MySQL data directory.

Keyring operations are transactional:component_keyring_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_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 inSection 8.4.4.15, “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_file, seeSection 8.4.4.13, “Supported Keyring Key Types and Lengths”.