Blame doc/man3/SSL_get_peer_cert_chain.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
SSL_get_peer_cert_chain, SSL_get0_verified_chain - get the X509 certificate
Packit c4476c
chain of the peer
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/ssl.h>
Packit c4476c
Packit c4476c
 STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl);
Packit c4476c
 STACK_OF(X509) *SSL_get0_verified_chain(const SSL *ssl);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
SSL_get_peer_cert_chain() returns a pointer to STACK_OF(X509) certificates
Packit c4476c
forming the certificate chain sent by the peer. If called on the client side,
Packit c4476c
the stack also contains the peer's certificate; if called on the server
Packit c4476c
side, the peer's certificate must be obtained separately using
Packit c4476c
L<SSL_get_peer_certificate(3)>.
Packit c4476c
If the peer did not present a certificate, NULL is returned.
Packit c4476c
Packit c4476c
NB: SSL_get_peer_cert_chain() returns the peer chain as sent by the peer: it
Packit c4476c
only consists of certificates the peer has sent (in the order the peer
Packit c4476c
has sent them) it is B<not> a verified chain.
Packit c4476c
Packit c4476c
SSL_get0_verified_chain() returns the B<verified> certificate chain
Packit c4476c
of the peer including the peer's end entity certificate. It must be called
Packit c4476c
after a session has been successfully established. If peer verification was
Packit c4476c
not successful (as indicated by SSL_get_verify_result() not returning
Packit c4476c
X509_V_OK) the chain may be incomplete or invalid.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
If the session is resumed peers do not send certificates so a NULL pointer
Packit c4476c
is returned by these functions. Applications can call SSL_session_reused()
Packit c4476c
to determine whether a session is resumed.
Packit c4476c
Packit c4476c
The reference count of each certificate in the returned STACK_OF(X509) object
Packit c4476c
is not incremented and the returned stack may be invalidated by renegotiation.
Packit c4476c
If applications wish to use any certificates in the returned chain
Packit c4476c
indefinitely they must increase the reference counts using X509_up_ref() or
Packit c4476c
obtain a copy of the whole chain with X509_chain_up_ref().
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
The following return values can occur:
Packit c4476c
Packit c4476c
=over 4
Packit c4476c
Packit c4476c
=item NULL
Packit c4476c
Packit c4476c
No certificate was presented by the peer or no connection was established
Packit c4476c
or the certificate chain is no longer available when a session is reused.
Packit c4476c
Packit c4476c
=item Pointer to a STACK_OF(X509)
Packit c4476c
Packit c4476c
The return value points to the certificate chain presented by the peer.
Packit c4476c
Packit c4476c
=back
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<ssl(7)>, L<SSL_get_peer_certificate(3)>, L<X509_up_ref(3)>,
Packit c4476c
L<X509_chain_up_ref(3)>
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut