MySQL 9.1.0
Source Code Documentation
|
The class implements AES-CTR encryption/decryption. More...
#include <stream_cipher.h>
Public Member Functions | |
~Aes_ctr_cipher () override | |
bool | open (const Key_string &password, int header_size) override |
Open the cipher with given password. More... | |
void | close () override |
Close the cipher. More... | |
bool | encrypt (unsigned char *dest, const unsigned char *src, int length) override |
Encrypt data. More... | |
bool | decrypt (unsigned char *dest, const unsigned char *src, int length) override |
Decrypt data. More... | |
bool | set_stream_offset (uint64_t offset) override |
Support encrypting/decrypting data at random position of a stream. More... | |
Public Member Functions inherited from Stream_cipher | |
virtual | ~Stream_cipher ()=default |
int | get_header_size () |
Returns the size of the header of the stream being encrypted/decrypted. More... | |
Static Public Attributes | |
static const int | PASSWORD_LENGTH = Aes_ctr::PASSWORD_LENGTH |
static const int | AES_BLOCK_SIZE = Aes_ctr::AES_BLOCK_SIZE |
static const int | FILE_KEY_LENGTH = Aes_ctr::FILE_KEY_LENGTH |
Private Member Functions | |
bool | init_cipher (uint64_t offset) |
Initialize OpenSSL cipher related context and IV. More... | |
void | deinit_cipher () |
Destroy OpenSSL cipher related context. More... | |
Private Attributes | |
EVP_CIPHER_CTX * | m_ctx = nullptr |
unsigned char | m_file_key [FILE_KEY_LENGTH] |
unsigned char | m_iv [AES_BLOCK_SIZE] |
Additional Inherited Members | |
Protected Attributes inherited from Stream_cipher | |
int | m_header_size = 0 |
The class implements AES-CTR encryption/decryption.
It supports to encrypt/decrypt a stream in both sequential and random way.
|
override |
|
overridevirtual |
Close the cipher.
Implements Stream_cipher.
|
overridevirtual |
Decrypt data.
[in] | dest | The buffer for storing decrypted data. It should be at least 'length' bytes. |
[in] | src | The data which will be decrypted. |
[in] | length | Length of the data. |
false | Success. |
true | Error. |
Implements Stream_cipher.
|
private |
Destroy OpenSSL cipher related context.
|
overridevirtual |
Encrypt data.
[in] | dest | The buffer for storing encrypted data. It should be at least 'length' bytes. |
[in] | src | The data which will be encrypted. |
[in] | length | Length of the data. |
false | Success. |
true | Error. |
Implements Stream_cipher.
|
private |
Initialize OpenSSL cipher related context and IV.
[in] | offset | The stream offset to compute the AES-CTR counter which will be set into IV. |
false | Success. |
true | Error. |
|
overridevirtual |
Open the cipher with given password.
[in] | password | The password which is used to initialize the cipher. |
[in] | header_size | The encrypted stream offset wrt the down stream. |
false | Success. |
true | Error. |
Implements Stream_cipher.
|
overridevirtual |
Support encrypting/decrypting data at random position of a stream.
[in] | offset | The stream offset of the data which will be encrypted/ decrypted in next encrypt()/decrypt() call. |
false | Success. |
true | Error. |
Implements Stream_cipher.
|
static |
|
static |
|
private |
|
private |
|
private |
|
static |