
#use wml::openssl-macros area=docs page=SSL_get_peer_cert_chain

<title>Documents, SSL_get_peer_cert_chain(3)</title>

<h1>SSL_get_peer_cert_chain(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
SSL_get_peer_cert_chain - get the X509 certificate chain of the peer

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/ssl.h&gt;
</PRE>
<PRE> STACKOF(X509) *SSL_get_peer_cert_chain(const SSL *ssl);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>SSL_get_peer_cert_chain()</CODE> returns a pointer to
<CODE>STACKOF(X509)</CODE> certificates forming the certificate chain of
the peer. If called on the client side, the stack also contains the peer's
certificate; if called on the server side, the peer's certificate must be
obtained separately using
<A HREF="../ssl/SSL_get_peer_certificate.html#">SSL_get_peer_certificate(3)</A>. If the peer did not present a certificate, NULL is returned.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
The peer certificate chain is not necessarily available after reusing a
session, in which case a NULL pointer is returned.

</P>
<P>
The reference count of the <CODE>STACKOF(X509)</CODE> object is not
incremented. If the corresponding session is freed, the pointer must not be
used any longer.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
The following return values can occur:

</P>
<DL>
<DT><STRONG><A NAME="item_NULL">NULL</A></STRONG><DD>
<P>
No certificate was presented by the peer or no connection was established
or the certificate chain is no longer available when a session is reused.

</P>
<DT><STRONG><A NAME="item_Pointer">Pointer to a STACKOF(X509)</A></STRONG><DD>
<P>
The return value points to the certificate chain presented by the peer.

</P>
</DL>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../ssl/ssl.html#">ssl(3)</A>, <A HREF="../ssl/SSL_get_peer_certificate.html#">SSL_get_peer_certificate(3)</A>



</P>
:}


