From 63de36ae12169a0e450c71f75a3c2816b13b8113 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 24 Jul 2017 16:02:47 +0800 Subject: [PATCH] Backport X509_check_private_key.pod to address #3973, and original PR to master branch is #3614 test case in the original PR is not applied. Reviewed-by: Andy Polyakov Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/4002) --- doc/crypto/X509_check_private_key.pod | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 doc/crypto/X509_check_private_key.pod diff --git a/doc/crypto/X509_check_private_key.pod b/doc/crypto/X509_check_private_key.pod new file mode 100644 index 0000000000..a1fb07b109 --- /dev/null +++ b/doc/crypto/X509_check_private_key.pod @@ -0,0 +1,54 @@ +=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 +request + +=head1 SYNOPSIS + + #include + + int X509_check_private_key(X509 *x, EVP_PKEY *k); + + int X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k); + +=head1 DESCRIPTION + +X509_check_private_key() function checks the consistency of private +key B with the public key in B. + +X509_REQ_check_private_key() is equivalent to X509_check_private_key() +except that B represents a certificate request of structure B. + +=head1 RETURN VALUE + +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. + +=head1 BUGS + +The B functions don't check if B itself is indeed +a private key or not. It merely compares 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 if you pass a public key to these functions in B, it will +return success. + +=head1 SEE ALSO + +L + +=head1 COPYRIGHT + +Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +L. + +=cut -- 2.25.1