SSL_get_peer_certificate.pod 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. =pod
  2. =head1 NAME
  3. SSL_get_peer_certificate - get the X509 certificate of the peer
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. X509 *SSL_get_peer_certificate(const SSL *ssl);
  7. =head1 DESCRIPTION
  8. SSL_get_peer_certificate() returns a pointer to the X509 certificate the
  9. peer presented. If the peer did not present a certificate, NULL is returned.
  10. =head1 NOTES
  11. Due to the protocol definition, a TLS/SSL server will always send a
  12. certificate, if present. A client will only send a certificate when
  13. explicitly requested to do so by the server (see
  14. L<SSL_CTX_set_verify(3)>). If an anonymous cipher
  15. is used, no certificates are sent.
  16. That a certificate is returned does not indicate information about the
  17. verification state, use L<SSL_get_verify_result(3)>
  18. to check the verification state.
  19. The reference count of the X509 object is incremented by one, so that it
  20. will not be destroyed when the session containing the peer certificate is
  21. freed. The X509 object must be explicitly freed using X509_free().
  22. =head1 RETURN VALUES
  23. The following return values can occur:
  24. =over 4
  25. =item NULL
  26. No certificate was presented by the peer or no connection was established.
  27. =item Pointer to an X509 certificate
  28. The return value points to the certificate presented by the peer.
  29. =back
  30. =head1 SEE ALSO
  31. L<ssl(7)>, L<SSL_get_verify_result(3)>,
  32. L<SSL_CTX_set_verify(3)>
  33. =head1 COPYRIGHT
  34. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  35. Licensed under the Apache License 2.0 (the "License"). You may not use
  36. this file except in compliance with the License. You can obtain a copy
  37. in the file LICENSE in the source distribution or at
  38. L<https://www.openssl.org/source/license.html>.
  39. =cut