1X509_CHECK_PRIVATE_KEY(3)           OpenSSL          X509_CHECK_PRIVATE_KEY(3)
2
3
4

NAME

6       X509_check_private_key, X509_REQ_check_private_key - check the
7       consistency of a private key with the public key in an X509 certificate
8       or certificate request
9

SYNOPSIS

11        #include <openssl/x509.h>
12
13        int X509_check_private_key(X509 *x, EVP_PKEY *k);
14
15        int X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k);
16

DESCRIPTION

18       X509_check_private_key() function checks the consistency of private key
19       k with the public key in x.
20
21       X509_REQ_check_private_key() is equivalent to X509_check_private_key()
22       except that x represents a certificate request of structure X509_REQ.
23

RETURN VALUES

25       X509_check_private_key() and X509_REQ_check_private_key() return 1 if
26       the keys match each other, and 0 if not.
27
28       If the key is invalid or an error occurred, the reason code can be
29       obtained using ERR_get_error(3).
30

BUGS

32       The check_private_key functions don't check if k itself is indeed a
33       private key or not. It merely compares the public materials (e.g.
34       exponent and modulus of an RSA key) and/or key parameters (e.g. EC
35       params of an EC key) of a key pair. So if you pass a public key to
36       these functions in k, it will return success.
37

SEE ALSO

39       ERR_get_error(3)
40
42       Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
43
44       Licensed under the OpenSSL license (the "License").  You may not use
45       this file except in compliance with the License.  You can obtain a copy
46       in the file LICENSE in the source distribution or at
47       <https://www.openssl.org/source/license.html>.
48
49
50
511.1.1g                            2020-04-23         X509_CHECK_PRIVATE_KEY(3)
Impressum