Топ-100
 

ASYMMETRIC_VERIFY

База данных: MySQL
Текст

Syntax:
asymmetric_verify(algorithm, digest_str, sig_str, pub_key_str,
digest_type)

Verifies whether the signature string matches the digest string, and
returns 1 or 0 to indicate whether verification succeeded or failed.

digest_str is the digest string. It can be generated by calling
create_digest(). digest_type indicates the digest algorithm used to
generate the digest string.

sig_str is the signature string. It can be generated by calling
asymmetric_sign().

pub_key_str is the public key string of the signer. It corresponds to
the private key passed to asymmetric_sign() to generate the signature
string and must be a valid key string in PEM format. algorithm
indicates the encryption algorithm used to create the key.

Supported algorithm values: 'RSA', 'DSA'

Supported digest_type values: 'SHA224', 'SHA256', 'SHA384', 'SHA512'

URL: https://dev.mysql.com/doc/refman/8.0/en/enterprise-encryption-functions.html

Пример

-- Set the encryption algorithm and digest type
SET @algo = 'RSA';
SET @dig_type = 'SHA224';

-- Create private/public key pair
SET @priv = create_asymmetric_priv_key(@algo, 1024);
SET @pub = create_asymmetric_pub_key(@algo, @priv);

-- Generate digest from string
SET @dig = create_digest(@dig_type, 'The quick brown fox');

-- Generate signature for digest and verify signature against digest
SET @sig = asymmetric_sign(@algo, @dig, @priv, @dig_type);
SET @verf = asymmetric_verify(@algo, @dig, @sig, @pub, @dig_type);