Encryption Scheme Service
Plugin API reference: Encryption Scheme Service. Generated from the MariaDB server headers by doxygen and moxygen.
A higher-level access to encryption service.
This is a helper service that storage engines use to encrypt tables on disk. It requests keys from the plugin, generates temporary or local keys from the global (as returned by the plugin) keys, etc.
To use the service:
st_encryption_scheme object is created per space. A "space" can be a table space in XtraDB/InnoDB, a file in Aria, etc. The whole space is encrypted with the one key id.
The service does not take the key and the IV as parameters for encryption or decryption. Instead it takes two 32-bit integers and one 64-bit integer (and requests the key from an encryption plugin, if needed).
The service requests the global key from the encryption plugin automatically as needed. Three last keys are cached in the st_encryption_scheme. Number of key requests (number of cache misses) are counted in st_encryption_scheme::keyserver_requests
If an st_encryption_scheme can be used concurrently by different threads, it needs to be able to lock itself when accessing the key cache. Set the st_encryption_scheme::locker appropriately. If non-zero, it will be invoked by encrypt/decrypt functions to lock and unlock the scheme when needed.
Implementation details (in particular, key derivation) are defined by the scheme type. Currently only schema type 1 is supported.
In the schema type 1, every "space" (table space in XtraDB/InnoDB, file in Aria) is encrypted with a different space-local key:
Every space has a 16-byte unique identifier (typically it's generated randomly and stored in the space). The caller should put it into st_encryption_scheme::iv.
Space-local key is generated by encrypting this identifier with the global encryption key (of the given id and version) using AES_ECB.
Encryption/decryption parameters for a page are typically the 4-byte space id, 4-byte page position (offset, page number, etc), and the 8-byte LSN. This guarantees that they'll be different for any two pages (of the same or different tablespaces) and also that they'll change for the same page when it's modified. They don't need to be secret (they create the IV, not the encryption key).
Classes
Macros
ENCRYPTION_SCHEME_KEY_INVALID
Defined in service_encryption_scheme.h:74
ENCRYPTION_SCHEME_BLOCK_LENGTH
Defined in service_encryption_scheme.h:75
encryption_scheme_encrypt
Defined in service_encryption_scheme.h:109
encryption_scheme_decrypt
Defined in service_encryption_scheme.h:110
MYSQL_SERVICE_ENCRYPTION_SCHEME_INCLUDED
Defined in service_encryption_scheme.h:132
Variables
encryption_scheme_service
Type: struct encryption_scheme_service_st *
Defined in service_encryption_scheme.h:105
Class Definitions
st_encryption_scheme_key
Defined in service_encryption_scheme.h:77
Public Attributes
version
Defined in service_encryption_scheme.h:78
key
Defined in service_encryption_scheme.h:79
st_encryption_scheme
Defined in service_encryption_scheme.h:82
Public Attributes
iv
Defined in service_encryption_scheme.h:83
key
Defined in service_encryption_scheme.h:84
keyserver_requests
Defined in service_encryption_scheme.h:85
key_id
Defined in service_encryption_scheme.h:86
type
Defined in service_encryption_scheme.h:87
locker
Defined in service_encryption_scheme.h:89
encryption_scheme_service_st
Defined in service_encryption_scheme.h:92
Public Attributes
encryption_scheme_encrypt_func
Defined in service_encryption_scheme.h:93
encryption_scheme_decrypt_func
Defined in service_encryption_scheme.h:99
This page is licensed: GPLv2
Last updated
Was this helpful?

