![]()  | 
  
    MySQL 9.5.0
    
   Source Code Documentation 
   | 
 
Wrapper to give simple interface for MySQL to AES standard encryption. More...
#include "my_inttypes.h"#include "my_macros.h"#include <string>#include <vector>#include <openssl/evp.h>Go to the source code of this file.
Macros | |
| #define | MY_AES_IV_SIZE 16 | 
| AES IV size is 16 bytes for all supported ciphers except ECB.  More... | |
| #define | MY_AES_BLOCK_SIZE 16 | 
| AES block size is fixed to be 128 bits for CBC and ECB.  More... | |
| #define | MY_AES_BEGIN my_aes_128_ecb | 
| #define | MY_AES_END my_aes_256_ofb | 
| #define | MY_AES_BAD_DATA -1 | 
Enumerations | |
| enum | my_aes_opmode {  my_aes_128_ecb , my_aes_192_ecb , my_aes_256_ecb , my_aes_128_cbc , my_aes_192_cbc , my_aes_256_cbc , my_aes_128_cfb1 , my_aes_192_cfb1 , my_aes_256_cfb1 , my_aes_128_cfb8 , my_aes_192_cfb8 , my_aes_256_cfb8 , my_aes_128_cfb128 , my_aes_192_cfb128 , my_aes_256_cfb128 , my_aes_128_ofb , my_aes_192_ofb , my_aes_256_ofb }  | 
| Supported AES cipher/block mode combos.  More... | |
Functions | |
| int | my_aes_encrypt (const unsigned char *source, uint32 source_length, unsigned char *dest, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, const unsigned char *iv, bool padding=true, vector< string > *kdf_options=nullptr) | 
| Encrypt a buffer using AES.  More... | |
| int | my_aes_encrypt (EVP_CIPHER_CTX *ctx, const unsigned char *source, uint32 source_length, unsigned char *dest, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, const unsigned char *iv, bool padding=true, vector< string > *kdf_options=nullptr) | 
| Encrypt a buffer using AES.  More... | |
| int | my_aes_decrypt (const unsigned char *source, uint32 source_length, unsigned char *dest, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, const unsigned char *iv, bool padding=true, vector< string > *kdf_options=nullptr) | 
| Decrypt an AES encrypted buffer.  More... | |
| int | my_aes_decrypt (EVP_CIPHER_CTX *ctx, const unsigned char *source, uint32 source_length, unsigned char *dest, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, const unsigned char *iv, bool padding=true, vector< string > *kdf_options=nullptr) | 
| Decrypt an AES encrypted buffer.  More... | |
| longlong | my_aes_get_size (uint32 source_length, enum my_aes_opmode opmode) | 
| Calculate the size of a buffer large enough for encrypted data.  More... | |
| bool | my_aes_needs_iv (my_aes_opmode opmode) | 
| Return true if the AES cipher and block mode requires an IV.  More... | |
Variables | |
| const char * | my_aes_opmode_names [] | 
| String representations of the supported AES modes.  More... | |
Wrapper to give simple interface for MySQL to AES standard encryption.
| #define MY_AES_BAD_DATA -1 | 
| #define MY_AES_BEGIN my_aes_128_ecb | 
| #define MY_AES_BLOCK_SIZE 16 | 
AES block size is fixed to be 128 bits for CBC and ECB.
| #define MY_AES_END my_aes_256_ofb | 
| #define MY_AES_IV_SIZE 16 | 
AES IV size is 16 bytes for all supported ciphers except ECB.
| enum my_aes_opmode | 
Supported AES cipher/block mode combos.
| int my_aes_decrypt | ( | const unsigned char * | source, | 
| uint32 | source_length, | ||
| unsigned char * | dest, | ||
| const unsigned char * | key, | ||
| uint32 | key_length, | ||
| enum my_aes_opmode | mode, | ||
| const unsigned char * | iv, | ||
| bool | padding = true,  | 
        ||
| vector< string > * | kdf_options = nullptr  | 
        ||
| ) | 
Decrypt an AES encrypted buffer.
| source | Pointer to data for decryption | 
| source_length | size of encrypted data | 
| dest | buffer to place decrypted data (must be large enough) | 
| key | Key to be used for decryption | 
| key_length | Length of the key. Will handle keys of any length | 
| mode | encryption mode | 
| iv | 16 bytes initialization vector if needed. Otherwise NULL | 
| padding | if padding needed. | 
| kdf_options | KDF options | 
| int my_aes_decrypt | ( | EVP_CIPHER_CTX * | ctx, | 
| const unsigned char * | source, | ||
| uint32 | source_length, | ||
| unsigned char * | dest, | ||
| const unsigned char * | key, | ||
| uint32 | key_length, | ||
| enum my_aes_opmode | mode, | ||
| const unsigned char * | iv, | ||
| bool | padding = true,  | 
        ||
| vector< string > * | kdf_options = nullptr  | 
        ||
| ) | 
Decrypt an AES encrypted buffer.
This version accepts operation context as parameter, for possible performance improvement.
| ctx | Pointer to OpenSSL operation context | 
| source | Pointer to data for decryption | 
| source_length | size of encrypted data | 
| dest | buffer to place decrypted data (must be large enough) | 
| key | Key to be used for decryption | 
| key_length | Length of the key. Will handle keys of any length | 
| mode | encryption mode | 
| iv | 16 bytes initialization vector if needed. Otherwise NULL | 
| padding | if padding needed. | 
| kdf_options | KDF options | 
| int my_aes_encrypt | ( | const unsigned char * | source, | 
| uint32 | source_length, | ||
| unsigned char * | dest, | ||
| const unsigned char * | key, | ||
| uint32 | key_length, | ||
| enum my_aes_opmode | mode, | ||
| const unsigned char * | iv, | ||
| bool | padding = true,  | 
        ||
| vector< string > * | kdf_options = nullptr  | 
        ||
| ) | 
Encrypt a buffer using AES.
| [in] | source | Pointer to data for encryption | 
| [in] | source_length | Size of encryption data | 
| [out] | dest | Buffer to place encrypted data (must be large enough and not overlap with source) | 
| [in] | key | Key to be used for encryption | 
| [in] | key_length | Length of the key. Will handle keys of any length | 
| [in] | mode | encryption mode | 
| [in] | iv | 16 bytes initialization vector if needed. Otherwise NULL | 
| [in] | padding | if padding needed. | 
| kdf_options | KDF options | 
| int my_aes_encrypt | ( | EVP_CIPHER_CTX * | ctx, | 
| const unsigned char * | source, | ||
| uint32 | source_length, | ||
| unsigned char * | dest, | ||
| const unsigned char * | key, | ||
| uint32 | key_length, | ||
| enum my_aes_opmode | mode, | ||
| const unsigned char * | iv, | ||
| bool | padding = true,  | 
        ||
| vector< string > * | kdf_options = nullptr  | 
        ||
| ) | 
Encrypt a buffer using AES.
This version accepts operation context as parameter, for possible performance improvement.
| [in] | ctx | Pointer to OpenSSL operation context | 
| [in] | source | Pointer to data for encryption | 
| [in] | source_length | Size of encryption data | 
| [out] | dest | Buffer to place encrypted data (must be large enough and not overlap with source) | 
| [in] | key | Key to be used for encryption | 
| [in] | key_length | Length of the key. Will handle keys of any length | 
| [in] | mode | encryption mode | 
| [in] | iv | 16 bytes initialization vector if needed. Otherwise NULL | 
| [in] | padding | if padding needed. | 
| kdf_options | KDF options | 
| longlong my_aes_get_size | ( | uint32 | source_length, | 
| enum my_aes_opmode | opmode | ||
| ) | 
Calculate the size of a buffer large enough for encrypted data.
| source_length | length of data to be encrypted | 
| opmode | encryption mode | 
| bool my_aes_needs_iv | ( | my_aes_opmode | opmode | ) | 
Return true if the AES cipher and block mode requires an IV.
| opmode | encryption mode | 
| true | IV needed | 
| false | IV not needed | 
      
  | 
  extern | 
String representations of the supported AES modes.
Keep in sync with my_aes_opmode