2000-09-20 16:55:26 +00:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2016-02-06 03:17:23 +00:00
|
|
|
SSL_get_peer_cert_chain, SSL_get0_verified_chain - get the X509 certificate
|
|
|
|
chain of the peer
|
2000-09-20 16:55:26 +00:00
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
|
2014-04-13 13:10:17 +00:00
|
|
|
STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl);
|
2016-02-06 03:17:23 +00:00
|
|
|
STACK_OF(X509) *SSL_get0_verified_chain(const SSL *ssl);
|
2000-09-20 16:55:26 +00:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2014-04-13 13:10:17 +00:00
|
|
|
SSL_get_peer_cert_chain() returns a pointer to STACK_OF(X509) certificates
|
2016-02-06 03:17:23 +00:00
|
|
|
forming the certificate chain sent by the peer. If called on the client side,
|
2000-09-20 16:55:26 +00:00
|
|
|
the stack also contains the peer's certificate; if called on the server
|
2001-02-16 02:09:53 +00:00
|
|
|
side, the peer's certificate must be obtained separately using
|
2015-08-17 19:21:33 +00:00
|
|
|
L<SSL_get_peer_certificate(3)>.
|
2000-09-20 16:55:26 +00:00
|
|
|
If the peer did not present a certificate, NULL is returned.
|
|
|
|
|
2017-01-18 00:40:36 +00:00
|
|
|
NB: SSL_get_peer_cert_chain() returns the peer chain as sent by the peer: it
|
2016-02-06 03:17:23 +00:00
|
|
|
only consists of certificates the peer has sent (in the order the peer
|
|
|
|
has sent them) it is B<not> a verified chain.
|
|
|
|
|
|
|
|
SSL_get0_verified_chain() returns the B<verified> certificate chain
|
|
|
|
of the peer including the peer's end entity certificate. It must be called
|
|
|
|
after a session has been successfully established. If peer verification was
|
|
|
|
not successful (as indicated by SSL_get_verify_result() not returning
|
|
|
|
X509_V_OK) the chain may be incomplete or invalid.
|
|
|
|
|
2000-09-20 16:55:26 +00:00
|
|
|
=head1 NOTES
|
|
|
|
|
2016-02-07 23:20:53 +00:00
|
|
|
If the session is resumed peers do not send certificates so a NULL pointer
|
|
|
|
is returned by these functions. Applications can call SSL_session_reused()
|
|
|
|
to determine whether a session is resumed.
|
2000-09-20 16:55:26 +00:00
|
|
|
|
2016-02-06 03:17:23 +00:00
|
|
|
The reference count of each certificate in the returned STACK_OF(X509) object
|
|
|
|
is not incremented and the returned stack may be invalidated by renegotiation.
|
|
|
|
If applications wish to use any certificates in the returned chain
|
|
|
|
indefinitely they must increase the reference counts using X509_up_ref() or
|
|
|
|
obtain a copy of the whole chain with X509_chain_up_ref().
|
2000-09-20 16:55:26 +00:00
|
|
|
|
|
|
|
=head1 RETURN VALUES
|
|
|
|
|
|
|
|
The following return values can occur:
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
=item NULL
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2014-04-13 13:10:17 +00:00
|
|
|
=item Pointer to a STACK_OF(X509)
|
2000-09-20 16:55:26 +00:00
|
|
|
|
|
|
|
The return value points to the certificate chain presented by the peer.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2016-11-11 08:33:09 +00:00
|
|
|
L<ssl(7)>, L<SSL_get_peer_certificate(3)>, L<X509_up_ref(3)>,
|
2016-02-06 03:17:23 +00:00
|
|
|
L<X509_chain_up_ref(3)>
|
2000-09-20 16:55:26 +00:00
|
|
|
|
2016-05-18 15:44:05 +00:00
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
|
|
|
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
|
|
|
|
Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|