2
0

SSL_get_peer_certificate.pod 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. =pod
  2. =head1 NAME
  3. SSL_get_peer_certificate,
  4. SSL_get0_peer_certificate,
  5. SSL_get1_peer_certificate - get the X509 certificate of the peer
  6. =head1 SYNOPSIS
  7. #include <openssl/ssl.h>
  8. X509 *SSL_get0_peer_certificate(const SSL *ssl);
  9. X509 *SSL_get1_peer_certificate(const SSL *ssl);
  10. The following function has been deprecated since OpenSSL 3.0,
  11. and can be hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable
  12. version value, see L<openssl_user_macros(7)>:
  13. X509 *SSL_get_peer_certificate(const SSL *ssl);
  14. =head1 DESCRIPTION
  15. These functions return a pointer to the X509 certificate the
  16. peer presented. If the peer did not present a certificate, NULL is returned.
  17. =head1 NOTES
  18. Due to the protocol definition, a TLS/SSL server will always send a
  19. certificate, if present. A client will only send a certificate when
  20. explicitly requested to do so by the server (see
  21. L<SSL_CTX_set_verify(3)>). If an anonymous cipher
  22. is used, no certificates are sent.
  23. That a certificate is returned does not indicate information about the
  24. verification state, use L<SSL_get_verify_result(3)>
  25. to check the verification state.
  26. The reference count of the X509 object returned by SSL_get1_peer_certificate()
  27. is incremented by one, so that it will not be destroyed when the session
  28. containing the peer certificate is freed. The X509 object must be explicitly
  29. freed using X509_free().
  30. The reference count of the X509 object returned by SSL_get0_peer_certificate()
  31. is not incremented, and must not be freed.
  32. SSL_get_peer_certificate() is an alias of SSL_get1_peer_certificate().
  33. =head1 RETURN VALUES
  34. The following return values can occur:
  35. =over 4
  36. =item NULL
  37. No certificate was presented by the peer or no connection was established.
  38. =item Pointer to an X509 certificate
  39. The return value points to the certificate presented by the peer.
  40. =back
  41. =head1 SEE ALSO
  42. L<ssl(7)>, L<SSL_get_verify_result(3)>,
  43. L<SSL_CTX_set_verify(3)>
  44. =head1 HISTORY
  45. SSL_get0_peer_certificate() and SSL_get1_peer_certificate() were added in 3.0.0.
  46. SSL_get_peer_certificate() was deprecated in 3.0.0.
  47. =head1 COPYRIGHT
  48. Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.
  49. Licensed under the Apache License 2.0 (the "License"). You may not use
  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. =cut