]>
Commit | Line | Data |
---|---|---|
7b986339 PY |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
5 | X509_check_private_key, X509_REQ_check_private_key - check the consistency | |
6 | of a private key with the public key in an X509 certificate or certificate | |
09ddb878 | 7 | request |
7b986339 PY |
8 | |
9 | =head1 SYNOPSIS | |
10 | ||
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 | ||
17 | =head1 DESCRIPTION | |
18 | ||
19 | X509_check_private_key() function checks the consistency of private | |
20 | key B<k> with the public key in B<x>. | |
21 | ||
22 | X509_REQ_check_private_key() is equivalent to X509_check_private_key() | |
23 | except that B<x> represents a certificate request of structure B<X509_REQ>. | |
24 | ||
1f13ad31 | 25 | =head1 RETURN VALUES |
7b986339 PY |
26 | |
27 | X509_check_private_key() and X509_REQ_check_private_key() return 1 if | |
28 | the keys match each other, and 0 if not. | |
29 | ||
30 | If the key is invalid or an error occurred, the reason code can be | |
31 | obtained using L<ERR_get_error(3)>. | |
32 | ||
33 | =head1 BUGS | |
34 | ||
35 | The B<check_private_key> functions don't check if B<k> itself is indeed | |
36 | a private key or not. It merely compares the public materials (e.g. exponent | |
37 | and modulus of an RSA key) and/or key parameters (e.g. EC params of an EC key) | |
38 | of a key pair. So if you pass a public key to these functions in B<k>, it will | |
39 | return success. | |
40 | ||
41 | =head1 SEE ALSO | |
42 | ||
43 | L<ERR_get_error(3)> | |
44 | ||
45 | =head1 COPYRIGHT | |
46 | ||
61f805c1 | 47 | Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. |
7b986339 | 48 | |
4746f25a | 49 | Licensed under the Apache License 2.0 (the "License"). You may not use |
7b986339 PY |
50 | this file except in compliance with the License. You can obtain a copy |
51 | in the file LICENSE in the source distribution or at | |
52 | L<https://www.openssl.org/source/license.html>. | |
53 | ||
54 | =cut |