SSL_get_peer_cert_chain.pod 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. =pod
  2. =head1 NAME
  3. SSL_get_peer_cert_chain, SSL_get0_verified_chain - get the X509 certificate
  4. chain of the peer
  5. =head1 SYNOPSIS
  6. #include <openssl/ssl.h>
  7. STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl);
  8. STACK_OF(X509) *SSL_get0_verified_chain(const SSL *ssl);
  9. =head1 DESCRIPTION
  10. SSL_get_peer_cert_chain() returns a pointer to STACK_OF(X509) certificates
  11. forming the certificate chain sent by the peer. If called on the client side,
  12. the stack also contains the peer's certificate; if called on the server
  13. side, the peer's certificate must be obtained separately using
  14. L<SSL_get_peer_certificate(3)>.
  15. If the peer did not present a certificate, NULL is returned.
  16. NB: SSL_get_peer_cert_chain() returns the peer chain as sent by the peer: it
  17. only consists of certificates the peer has sent (in the order the peer
  18. has sent them) it is B<not> a verified chain.
  19. SSL_get0_verified_chain() returns the B<verified> certificate chain
  20. of the peer including the peer's end entity certificate. It must be called
  21. after a session has been successfully established. If peer verification was
  22. not successful (as indicated by SSL_get_verify_result() not returning
  23. X509_V_OK) the chain may be incomplete or invalid.
  24. =head1 NOTES
  25. If the session is resumed peers do not send certificates so a NULL pointer
  26. is returned by these functions. Applications can call SSL_session_reused()
  27. to determine whether a session is resumed.
  28. The reference count of each certificate in the returned STACK_OF(X509) object
  29. is not incremented and the returned stack may be invalidated by renegotiation.
  30. If applications wish to use any certificates in the returned chain
  31. indefinitely they must increase the reference counts using X509_up_ref() or
  32. obtain a copy of the whole chain with X509_chain_up_ref().
  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. or the certificate chain is no longer available when a session is reused.
  39. =item Pointer to a STACK_OF(X509)
  40. The return value points to the certificate chain presented by the peer.
  41. =back
  42. =head1 SEE ALSO
  43. L<ssl(7)>, L<SSL_get_peer_certificate(3)>, L<X509_up_ref(3)>,
  44. L<X509_chain_up_ref(3)>
  45. =head1 COPYRIGHT
  46. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  47. Licensed under the OpenSSL license (the "License"). You may not use
  48. this file except in compliance with the License. You can obtain a copy
  49. in the file LICENSE in the source distribution or at
  50. L<https://www.openssl.org/source/license.html>.
  51. =cut