X509_check_private_key.pod 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. =pod
  2. =head1 NAME
  3. X509_check_private_key, X509_REQ_check_private_key - check the consistency
  4. of a private key with the public key in an X509 certificate or certificate
  5. request
  6. =head1 SYNOPSIS
  7. #include <openssl/x509.h>
  8. int X509_check_private_key(X509 *x, EVP_PKEY *k);
  9. int X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k);
  10. =head1 DESCRIPTION
  11. X509_check_private_key() function checks the consistency of private
  12. key B<k> with the public key in B<x>.
  13. X509_REQ_check_private_key() is equivalent to X509_check_private_key()
  14. except that B<x> represents a certificate request of structure B<X509_REQ>.
  15. =head1 RETURN VALUES
  16. X509_check_private_key() and X509_REQ_check_private_key() return 1 if
  17. the keys match each other, and 0 if not.
  18. If the key is invalid or an error occurred, the reason code can be
  19. obtained using L<ERR_get_error(3)>.
  20. =head1 BUGS
  21. The B<check_private_key> functions don't check if B<k> itself is indeed
  22. a private key or not. It merely compares the public materials (e.g. exponent
  23. and modulus of an RSA key) and/or key parameters (e.g. EC params of an EC key)
  24. of a key pair. So if you pass a public key to these functions in B<k>, it will
  25. return success.
  26. =head1 SEE ALSO
  27. L<ERR_get_error(3)>
  28. =head1 COPYRIGHT
  29. Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
  30. Licensed under the Apache License 2.0 (the "License"). You may not use
  31. this file except in compliance with the License. You can obtain a copy
  32. in the file LICENSE in the source distribution or at
  33. L<https://www.openssl.org/source/license.html>.
  34. =cut