mbedtls_x509_crt_parse_der_with_ext_cb() function
Parse a single DER formatted certificate and add it to the end of the provided chained list.
Arguments
chain
The pointer to the start of the CRT chain to attach to. When parsing the first CRT in a chain, this should point to an instance of ::mbedtls_x509_crt initialized through mbedtls_x509_crt_init().
buf
The buffer holding the DER encoded certificate.
buflen
The size in Bytes of \p buf.
make_copy
When not zero this function makes an internal copy of the CRT buffer \p buf. In particular, \p buf may be destroyed or reused after this call returns. When zero this function avoids duplicating the CRT buffer by taking temporary ownership thereof until the CRT is destroyed (like mbedtls_x509_crt_parse_der_nocopy())
cb
A callback invoked for every unsupported certificate extension.
p_ctx
An opaque context passed to the callback.
Return value
\c 0 if successful. A negative error code on failure.
Notes
If #MBEDTLS_USE_PSA_CRYPTO is enabled, the PSA crypto subsystem must have been initialized by calling psa_crypto_init() before calling this function. This call is functionally equivalent to mbedtls_x509_crt_parse_der(), and/or mbedtls_x509_crt_parse_der_nocopy() but it calls the callback with every unsupported certificate extension and additionally the "certificate policies" extension if it contains any unsupported certificate policies. The callback must return a negative error code if it does not know how to handle such an extension. When the callback fails to parse a critical extension mbedtls_x509_crt_parse_der_with_ext_cb() also fails. When the callback fails to parse a non critical extension mbedtls_x509_crt_parse_der_with_ext_cb() simply skips the extension and continues parsing. Future versions of the library may invoke the callback in other cases, if and when the need arises.