

© 2025 by The Clinic. Powered and secured by Wix
MySQL:
ASYMMETRIC_DERIVE
Syntax:
asymmetric_derive(pub_key_str, priv_key_str)
Derives a symmetric key using the private key of one party and the
public key of another, and returns the resulting key as a binary
string. If key derivation fails, the result is NULL.
pub_key_str and priv_key_str must be valid key strings in PEM format.
They must be created using the DH algorithm.
Suppose that you have two pairs of public and private keys:
SET @dhp = create_dh_parameters(1024);
SET @priv1 = create_asymmetric_priv_key('DH', @dhp);
SET @pub1 = create_asymmetric_pub_key('DH', @priv1);
SET @priv2 = create_asymmetric_priv_key('DH', @dhp);
SET @pub2 = create_asymmetric_pub_key('DH', @priv2);
Suppose further that you use the private key from one pair and the
public key from the other pair to create a symmetric key string. Then
this symmetric key identity relationship holds:
asymmetric_derive(@pub1, @priv2) = asymmetric_derive(@pub2, @priv1)
Example