2017-06-05 03:14:15 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
X509_check_private_key, X509_REQ_check_private_key - check the consistency
|
|
|
|
of a private key with the public key in an X509 certificate or certificate
|
2017-06-05 03:56:07 +08:00
|
|
|
request
|
2017-06-05 03:14:15 +08:00
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/x509.h>
|
|
|
|
|
2022-08-01 23:43:00 +08:00
|
|
|
int X509_check_private_key(const X509 *cert, EVP_PKEY *pkey);
|
2017-06-05 03:14:15 +08:00
|
|
|
|
2022-08-01 23:43:00 +08:00
|
|
|
int X509_REQ_check_private_key(X509_REQ *req, EVP_PKEY *pkey);
|
2017-06-05 03:14:15 +08:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
X509_check_private_key() function checks the consistency of private
|
2022-08-01 23:43:00 +08:00
|
|
|
key I<pkey> with the public key in I<cert>.
|
2017-06-05 03:14:15 +08:00
|
|
|
|
|
|
|
X509_REQ_check_private_key() is equivalent to X509_check_private_key()
|
2022-08-01 23:43:00 +08:00
|
|
|
except that I<req> represents a certificate request of structure B<X509_REQ>.
|
2017-06-05 03:14:15 +08:00
|
|
|
|
2017-12-25 17:50:39 +08:00
|
|
|
=head1 RETURN VALUES
|
2017-06-05 03:14:15 +08:00
|
|
|
|
|
|
|
X509_check_private_key() and X509_REQ_check_private_key() return 1 if
|
|
|
|
the keys match each other, and 0 if not.
|
|
|
|
|
|
|
|
If the key is invalid or an error occurred, the reason code can be
|
|
|
|
obtained using L<ERR_get_error(3)>.
|
|
|
|
|
|
|
|
=head1 BUGS
|
|
|
|
|
2022-08-01 23:43:00 +08:00
|
|
|
The X509_check_private_key() and X509_REQ_check_private_key() functions
|
|
|
|
do not check if I<pkey> itself is indeed a private key or not.
|
|
|
|
They merely compare the public materials (e.g., exponent and modulus of an RSA
|
|
|
|
key) and/or key parameters (e.g. EC params of an EC key) of a key pair.
|
|
|
|
So they also return success if I<pkey> is a matching public key.
|
2017-06-05 03:14:15 +08:00
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
|
|
|
L<ERR_get_error(3)>
|
|
|
|
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2018-01-16 01:01:46 +08:00
|
|
|
Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
2017-06-05 03:14:15 +08:00
|
|
|
|
2018-12-06 21:04:44 +08:00
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
2017-06-05 03:14:15 +08:00
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|