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
22       SSL_CTX_set_verify(3)). If an anonymous cipher is used, no certificates
23       are sent.
24
25       That a certificate is returned does not indicate information about the
26       verification state, use SSL_get_verify_result(3) to check the
27       verification state.
28
29       The reference count of the X509 object is incremented by one, so that
30       it will not be destroyed when the session containing the peer
31       certificate is freed. The X509 object must be explicitly freed using
32       X509_free().
33

RETURN VALUES

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

SEE ALSO

45       ssl(7), SSL_get_verify_result(3), SSL_CTX_set_verify(3)
46
48       Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
49
50       Licensed under the OpenSSL license (the "License").  You may not use
51       this file except in compliance with the License.  You can obtain a copy
52       in the file LICENSE in the source distribution or at
53       <https://www.openssl.org/source/license.html>.
54
55
56
571.1.1q                            2023-07-20       SSL_GET_PEER_CERTIFICATE(3)
Impressum