1.\" $OpenBSD: X509_check_private_key.3,v 1.6 2019/06/06 01:06:59 schwarze Exp $ 2.\" OpenSSL X509_check_private_key.pod 09ddb878 Jun 5 03:56:07 2017 +0800 3.\" 4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd $Mdocdate: June 6 2019 $ 19.Dt X509_CHECK_PRIVATE_KEY 3 20.Os 21.Sh NAME 22.Nm X509_check_private_key , 23.Nm X509_REQ_check_private_key 24.Nd compare public key components 25.Sh SYNOPSIS 26.In openssl/x509.h 27.Ft int 28.Fo X509_check_private_key 29.Fa "const X509 *x" 30.Fa "const EVP_PKEY *k" 31.Fc 32.Ft int 33.Fo X509_REQ_check_private_key 34.Fa "X509_REQ *x" 35.Fa "EVP_PKEY *k" 36.Fc 37.Sh DESCRIPTION 38These functions are seriously misnamed. 39.Fn X509_check_private_key 40compares the 41.Em public 42key components (e.g. exponent and modulus of an RSA key) 43and parameters (e.g. EC params of an EC key) of 44.Fa k 45with the corresponding properties of 46.Fa x . 47Despite the name, it neither checks whether 48.Fa k 49contains private key components at all, nor, if any are present, 50whether they are consistent with the public key components. 51.Pp 52.Fn X509_REQ_check_private_key 53is equivalent to 54.Fn X509_check_private_key 55except that it compares to the public key 56contained in a certificate request. 57.Sh RETURN VALUES 58These functions return 1 if the public key components and parameters 59match, or 0 if they do not or if an error occurs. 60On error or mismatch, a reason code can be obtained using 61.Xr ERR_get_error 3 . 62.Sh SEE ALSO 63.Xr SSL_check_private_key 3 , 64.Xr X509_new 3 , 65.Xr X509_REQ_new 3 66.Sh HISTORY 67.Fn X509_check_private_key 68first appeared in SSLeay 0.6.5 and has been available since 69.Ox 2.4 . 70.Pp 71.Fn X509_REQ_check_private_key 72first appeared in OpenSSL 0.9.8 and has been available since 73.Ox 4.5 . 74