MySQL 8.0.39
Source Code Documentation
|
This is the base class to serialize and deserialize a replication log file encryption header. More...
#include <rpl_log_encryption.h>
Public Member Functions | |
virtual | ~Rpl_encryption_header () |
virtual bool | serialize (Basic_ostream *ostream)=0 |
Serialize the header into an output stream. More... | |
virtual bool | deserialize (Basic_istream *istream)=0 |
Deserialize encryption header from a stream. More... | |
virtual char | get_version () const =0 |
Get the header version. More... | |
virtual int | get_header_size ()=0 |
Return the header size to be taken into account when serializing an deserializing encrypted file headers from replication log files. More... | |
virtual Key_string | decrypt_file_password ()=0 |
Decrypt the file password. More... | |
virtual std::unique_ptr< Stream_cipher > | get_encryptor ()=0 |
Factory to generate ciphers to encrypt streams based on current header. More... | |
virtual std::unique_ptr< Stream_cipher > | get_decryptor ()=0 |
Factory to generate ciphers to decrypt streams based on current header. More... | |
virtual Key_string | generate_new_file_password ()=0 |
Setup the header with current master key and generates a new random file password. More... | |
virtual bool | encrypt_file_password (Key_string password_str)=0 |
Encrypt a file password using current replication encryption master key. More... | |
Static Public Member Functions | |
static std::unique_ptr< Rpl_encryption_header > | get_header (Basic_istream *istream) |
Deserialize the replication encrypted log file header from the given stream. More... | |
static std::unique_ptr< Rpl_encryption_header > | get_new_default_header () |
Generate a new replication encryption header based on the default replication encrypted log file header version. More... | |
static std::string | key_id_prefix () |
Build a key id prefix using default header version. More... | |
static std::string | seqno_to_key_id (uint32_t seqno) |
Build a key id using the given sequence number using default header version. More... | |
static std::string | key_id_with_suffix (const char *suffix) |
Build a key id using the given suffix using default header version. More... | |
static const char * | get_key_type () |
Return the default header version encryption key type. More... | |
Static Public Attributes | |
static const int | ENCRYPTION_MAGIC_SIZE = 4 |
static const char * | ENCRYPTION_MAGIC = "\xfd\x62\x69\x6e" |
Static Protected Attributes | |
static const int | VERSION_OFFSET = ENCRYPTION_MAGIC_SIZE |
static const int | VERSION_SIZE = 1 |
static const int | OPTIONAL_FIELD_OFFSET = VERSION_OFFSET + VERSION_SIZE |
Static Private Attributes | |
static const char | m_default_version = 1 |
This is the base class to serialize and deserialize a replication log file encryption header.
The new encrypted binary log file format is composed of two parts:
+---------------------+ | Encryption Header | +---------------------+ | Encrypted Data | +---------------------+
The encryption header exists only in the begin of encrypted replication log files.
+------------------------+----------------------------------------------+ | MAGIC HEADER (4 bytes) | Replication logs encryption version (1 byte) | +------------------------+----------------------------------------------+ | Version specific encryption header data | +-----------------------------------------------------------------------+ Encryption Header Format
Name | Format | Description |
---|---|---|
Magic Header | 4 Bytes | The content is always 0xFD62696E. It is similar to Binlog Magic Header. Binlog magic header is: 0xFE62696e. |
Replication logs encryption version | 1 Byte | The replication logs encryption version defines how the header shall be deserialized and how the Encrypted Data shall be decrypted. |
Version specific encryption data header | Depends on the version field | Data required to fetch a replication key from keyring and deserialize the Encrypted Data. |
|
virtual |
|
pure virtual |
Decrypt the file password.
Implemented in Rpl_encryption_header_v1.
|
pure virtual |
Deserialize encryption header from a stream.
[in] | istream | The input stream for deserializing the encryption header. |
false | Success. |
true | Error. |
Implemented in Rpl_encryption_header_v1.
|
pure virtual |
Encrypt a file password using current replication encryption master key.
[in] | password_str | The plain file password. |
false | Success. |
true | Error. |
Implemented in Rpl_encryption_header_v1.
|
pure virtual |
Setup the header with current master key and generates a new random file password.
This function shall be called when creating new replication log files.
Implemented in Rpl_encryption_header_v1.
|
pure virtual |
Factory to generate ciphers to decrypt streams based on current header.
Implemented in Rpl_encryption_header_v1.
|
pure virtual |
Factory to generate ciphers to encrypt streams based on current header.
Implemented in Rpl_encryption_header_v1.
|
static |
Deserialize the replication encrypted log file header from the given stream.
This function shall be called right after reading the magic from the stream. It will read the version of the encrypted log file header, instantiate a proper Rpl_encryption_header based on version and delegate the rest of the header deserialization to the new instance.
istream | The stream containing the header to deserialize. |
|
pure virtual |
Return the header size to be taken into account when serializing an deserializing encrypted file headers from replication log files.
Implemented in Rpl_encryption_header_v1.
|
static |
Return the default header version encryption key type.
|
static |
Generate a new replication encryption header based on the default replication encrypted log file header version.
|
pure virtual |
|
static |
Build a key id prefix using default header version.
|
static |
Build a key id using the given suffix using default header version.
[in] | suffix | The suffix used to build key id. |
|
static |
Build a key id using the given sequence number using default header version.
[in] | seqno | The sequence number used to build key id. |
|
pure virtual |
Serialize the header into an output stream.
ostream | The output stream to serialize the header. |
false | Success. |
true | Error. |
Implemented in Rpl_encryption_header_v1.
|
static |
|
static |
|
staticprivate |
|
staticprotected |
|
staticprotected |
|
staticprotected |