Skip to main content

mbedtls_pem_write_buffer

Function mbedtls_pem_write_buffer 

Source
pub unsafe extern "C" fn mbedtls_pem_write_buffer(
    header: *const c_char,
    footer: *const c_char,
    der_data: *const c_uchar,
    der_len: usize,
    buf: *mut c_uchar,
    buf_len: usize,
    olen: *mut usize,
) -> c_int
Expand description

\brief Write a buffer of PEM information from a DER encoded buffer.

\param header The header string to write. \param footer The footer string to write. \param der_data The DER data to encode. \param der_len The length of the DER data \p der_data in Bytes. \param buf The buffer to write to. \param buf_len The length of the output buffer \p buf in Bytes. \param olen The address at which to store the total length written or required (if \p buf_len is not enough).

\note You may pass \c NULL for \p buf and \c 0 for \p buf_len to request the length of the resulting PEM buffer in *olen.

\note This function may be called with overlapping \p der_data and \p buf buffers.

\return \c 0 on success. \return #MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL if \p buf isn’t large enough to hold the PEM buffer. In this case, *olen holds the required minimum size of \p buf. \return Another PEM or BASE64 error code on other kinds of failure.