1SSL_get_peer_certificate(3)         OpenSSL        SSL_get_peer_certificate(3)
2
3
4

NAME

6       SSL_get_peer_certificate - get the X509 certificate of the peer
7

SYNOPSIS

9        #include <openssl/ssl.h>
10
11        X509 *SSL_get_peer_certificate(const SSL *ssl);
12

DESCRIPTION

14       SSL_get_peer_certificate() returns a pointer to the X509 certificate
15       the peer presented. If the peer did not present a certificate, NULL is
16       returned.
17

NOTES

19       Due to the protocol definition, a TLS/SSL server will always send a
20       certificate, if present. A client will only send a certificate when
21       explicitly requested to do so by the server (see SSL_CTX_set_ver‐
22       ify(3)). If an anonymous cipher is used, no certificates are sent.
23
24       That a certificate is returned does not indicate information about the
25       verification state, use SSL_get_verify_result(3) to check the verifica‐
26       tion state.
27
28       The reference count of the X509 object is incremented by one, so that
29       it will not be destroyed when the session containing the peer certifi‐
30       cate is freed. The X509 object must be explicitly freed using
31       X509_free().
32

RETURN VALUES

34       The following return values can occur:
35
36       NULL
37           No certificate was presented by the peer or no connection was
38           established.
39
40       Pointer to an X509 certificate
41           The return value points to the certificate presented by the peer.
42

SEE ALSO

44       ssl(3), SSL_get_verify_result(3), SSL_CTX_set_verify(3)
45
46
47
480.9.8b                            2005-03-30       SSL_get_peer_certificate(3)
Impressum