Rechercher dans le manuel MySQL
12.19.2 MySQL Enterprise Encryption Usage and Examples
To use MySQL Enterprise Encryption in applications, invoke the functions that are appropriate for the operations you wish to perform. This section demonstrates how to carry out some representative tasks:
Create a private/public key pair using RSA encryption
- -- Encryption algorithm; can be 'DSA' or 'DH' instead
- -- Key length in bits; make larger for stronger keys
- -- Create private key
- -- Derive corresponding public key from private key, using same algorithm
Now you can use the key pair to encrypt and decrypt data, sign and verify data, or generate symmetric keys.
This requires that the members of the key pair be RSA keys.
Conversely, you can encrypt using the public key and decrypt using the private key.
In either case, the algorithm specified for the encryption and decryption functions must match that used to generate the keys.
The key pair can be used to sign data, then verify that the signature matches the digest.
- -- Encryption algorithm; could be 'DSA' instead; keys must
- -- have been created using same algorithm
- -- Generate signature for digest and verify signature against digest
- -- Verify signature against digest
This requires DH private/public keys as inputs, created using
a shared symmetric secret. Create the secret by passing the
key length to
CREATE_DH_PARAMETERS()
, then
pass the secret as the “key length” to
CREATE_ASYMMETRIC_PRIV_KEY()
.
- -- Generate DH shared symmetric secret
- -- Generate DH key pairs
- -- Generate symmetric key using public key of first party,
- -- private key of second party
- -- Or use public key of second party, private key of first party
Key string values can be created at runtime and stored into a
variable or table using
SET
,
SELECT
, or
INSERT
:
Key string values stored in files can be read using the
LOAD_FILE()
function by users
who have the FILE
privilege.
Digest and signature strings can be handled similarly.
The
CREATE_ASYMMETRIC_PRIV_KEY()
and CREATE_DH_PARAMETERS()
encryption functions take a key-length parameter, and the
amount of CPU resources required by these functions increases
as the key length increases. For some installations, this
might result in unacceptable CPU usage if applications
frequently generate excessively long keys.
OpenSSL imposes a minimum key length of 1,024 bits for all
keys. OpenSSL also imposes a maximum key length of 10,000 bits
and 16,384 bits for DSA and RSA keys, respectively, for
CREATE_ASYMMETRIC_PRIV_KEY()
,
and a maximum key length of 10,000 bits for
CREATE_DH_PARAMETERS()
. If
those maximum values are too high, three environment variables
are available to enable MySQL server administrators to set
lower maximum lengths for key generation, and thereby to limit
CPU usage:
MYSQL_OPENSSL_UDF_DSA_BITS_THRESHOLD
: Maximum DSA key length in bits forCREATE_ASYMMETRIC_PRIV_KEY()
. The minimum and maximum values for this variable are 1,024 and 10,000.MYSQL_OPENSSL_UDF_RSA_BITS_THRESHOLD
: Maximum RSA key length in bits forCREATE_ASYMMETRIC_PRIV_KEY()
. The minimum and maximum values for this variable are 1,024 and 16,384.MYSQL_OPENSSL_UDF_DH_BITS_THRESHOLD
: Maximum key length in bits forCREATE_DH_PARAMETERS()
. The minimum and maximum values for this variable are 1,024 and 10,000.
To use any of these environment variables, set them in the
environment of the process that starts the server. If set,
their values take precedence over the maximum key lengths
imposed by OpenSSL. For example, to set a maximum key length
of 4,096 bits for DSA and RSA keys for
CREATE_ASYMMETRIC_PRIV_KEY()
,
set these variables:
export MYSQL_OPENSSL_UDF_DSA_BITS_THRESHOLD=4096
export MYSQL_OPENSSL_UDF_RSA_BITS_THRESHOLD=4096
The example uses Bourne shell syntax. The syntax for other shells may differ.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-enterprise-encryption-usage.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.