mbedtls_ssl_get_peer_cert() is only used within mbedTLS.
 
Symbols
loading (3/5)...
Files
loading (4/5)...
SummarySyntaxArgumentsRelatedReferencesData Use

Return value

The current peer certificate, if available. The returned certificate is owned by the SSL context and is valid only until the next call to the SSL API. \c NULL if no peer certificate is available. This might be because the chosen ciphersuite doesn't use CRTs (PSK-based ciphersuites, for example), or because #MBEDTLS_SSL_KEEP_PEER_CERTIFICATE has been disabled, allowing the stack to free the peer's CRT to save memory.

Notes

For one-time inspection of the peer's certificate during the handshake, consider registering an X.509 CRT verification callback through mbedtls_ssl_conf_verify() instead of calling this function. Using mbedtls_ssl_conf_verify() also comes at the benefit of allowing you to influence the verification process, for example by masking expected and tolerated verification failures.

References