KeyringInfo class encapsulates loading and storing master key using master-key-reader and master-key-writer.
More...
#include <keyring_info.h>
KeyringInfo class encapsulates loading and storing master key using master-key-reader and master-key-writer.
◆ KeyringInfo() [1/2]
KeyringInfo::KeyringInfo |
( |
bool |
verbose = true | ) |
|
|
inlinenoexcept |
Default constructor.
- Parameters
-
verbose | IF true then log verbose error messages |
◆ KeyringInfo() [2/2]
KeyringInfo::KeyringInfo |
( |
const std::string & |
keyring_file, |
|
|
const std::string & |
master_key_file |
|
) |
| |
|
inline |
Constructs KeyringInfo and assigns keyring file and master key file.
- Parameters
-
keyring_file | The path to keyring file |
master_key_file | The path to master key file |
◆ add_router_id_to_env()
void KeyringInfo::add_router_id_to_env |
( |
uint32_t |
router_id | ) |
const |
Adds ROUTER_ID variable to environment.
- Exceptions
-
SetRouterIdEnvVariableError | if adding ROUTER_ID to environment fails. |
◆ generate_master_key()
void KeyringInfo::generate_master_key |
( |
| ) |
|
|
noexcept |
◆ get_keyring_file() [1/2]
const std::string & KeyringInfo::get_keyring_file |
( |
| ) |
const |
|
inlinenoexcept |
◆ get_keyring_file() [2/2]
Returns path to keyring file based on data read from config or bootstrap directory.
- Returns
- The path to keyring file
◆ get_master_key()
const std::string & KeyringInfo::get_master_key |
( |
| ) |
const |
|
inlinenoexcept |
◆ get_master_key_file()
const std::string & KeyringInfo::get_master_key_file |
( |
| ) |
const |
|
inlinenoexcept |
◆ get_master_key_reader()
const std::string & KeyringInfo::get_master_key_reader |
( |
| ) |
const |
|
inlinenoexcept |
◆ get_master_key_writer()
const std::string & KeyringInfo::get_master_key_writer |
( |
| ) |
const |
|
inlinenoexcept |
◆ init()
Initializes KeyringInfo using data read from Config.
It initializes keyring_file, master_key_file_, master_key_reader_ and master_key_writer.
- Parameters
-
config | The Config that is used to initialize KeyringInfo |
◆ read_master_key()
bool KeyringInfo::read_master_key |
( |
| ) |
|
|
noexcept |
Reads master key using master_key_reader_;.
- Returns
- true if successfully read master key, false otherwise.
◆ set_keyring_file()
void KeyringInfo::set_keyring_file |
( |
const std::string & |
keyring_file | ) |
|
|
inline |
◆ set_master_key()
void KeyringInfo::set_master_key |
( |
const std::string & |
master_key | ) |
|
|
inline |
◆ set_master_key_file()
void KeyringInfo::set_master_key_file |
( |
const std::string & |
master_key_file | ) |
|
|
inline |
◆ set_master_key_reader()
void KeyringInfo::set_master_key_reader |
( |
const std::string & |
master_key_reader | ) |
|
|
inline |
◆ set_master_key_writer()
void KeyringInfo::set_master_key_writer |
( |
const std::string & |
master_key_writer | ) |
|
|
inline |
◆ use_master_key_external_facility()
bool KeyringInfo::use_master_key_external_facility |
( |
| ) |
const |
|
noexcept |
Checks if master-key-reader/master-key-writer should be used to load/store master key.
- Returns
- true if master-key-reader/master-key-writer should be used to load/store master key, false otherwise.
◆ use_master_key_file()
bool KeyringInfo::use_master_key_file |
( |
| ) |
const |
|
noexcept |
Checks if mysqlrouter.key and keyring files should be used to store master key.
- Returns
- true if master key should be used to store master key, false otherwise.
◆ validate_master_key()
void KeyringInfo::validate_master_key |
( |
| ) |
const |
Checks if master key is correct: it cannot be empty, and cannot be longer than mysql_harness::kMaxKeyringKeyLength.
- Exceptions
-
std::runtime_error | if master key is empty or is longer than mysql_harness::kMaxKeyringKeyLength |
◆ write_master_key()
bool KeyringInfo::write_master_key |
( |
| ) |
const |
|
noexcept |
Writes master key using master_key_writer_;.
- Returns
- true if write was successful, false otherwise.
◆ keyring_file_
std::string KeyringInfo::keyring_file_ |
|
private |
The path to keyring file.
◆ master_key_
std::string KeyringInfo::master_key_ |
|
private |
The master key that is used to encode/decode keyring content.
◆ master_key_file_
std::string KeyringInfo::master_key_file_ |
|
private |
The path to master key file, empty if master key file is not used.
◆ master_key_reader_
std::string KeyringInfo::master_key_reader_ |
|
private |
The path to master-key-reader that is used to read master key.
◆ master_key_writer_
std::string KeyringInfo::master_key_writer_ |
|
private |
The path to master-key-writer that is used to store master key.
◆ rw_timeout_
std::chrono::milliseconds KeyringInfo::rw_timeout_ = std::chrono::milliseconds(30000) |
|
private |
The maximum time to write master key using master-key-writer or read master key using master-key-fetcher.
◆ verbose_
bool KeyringInfo::verbose_ = true |
|
private |
If true then log verbose error messages.
The documentation for this class was generated from the following files: