mbedtls_pem_read_buffer() function
Read a buffer for PEM information and store the resulting data into the specified context buffers.
Arguments
header string to seek and expect
footer string to seek and expect
data
source data to look in (must be nul-terminated)
pwd
password for decryption (can be NULL)
use_len
destination for total length used (set after header is correctly read, so unless you get MBEDTLS_ERR_PEM_BAD_INPUT_DATA or MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT, use_len is the length to skip)
Return value
0 on success, or a specific PEM error code
Notes
Attempts to check password correctness by verifying if the decrypted text starts with an ASN.1 sequence of appropriate length
mbedtls_pem_read_buffer() is called by 3 functions and calls 2 functions:
![]()
mbedtls_pem_read_buffer()
mbedtls_pem_read_buffer() writes 2 variables:
![]()
mbedtls_pem_read_buffer()