mbed TLS v3.1.0
|
Privacy Enhanced Mail (PEM) decoding. More...
Go to the source code of this file.
Data Structures | |
struct | mbedtls_pem_context |
PEM context structure. More... | |
Macros | |
PEM Error codes | |
These error codes are returned in case of errors reading the PEM data. | |
#define | MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080 |
#define | MBEDTLS_ERR_PEM_INVALID_DATA -0x1100 |
#define | MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180 |
#define | MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200 |
#define | MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280 |
#define | MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300 |
#define | MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380 |
#define | MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400 |
#define | MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480 |
Typedefs | |
typedef struct mbedtls_pem_context | mbedtls_pem_context |
PEM context structure. More... | |
Functions | |
void | mbedtls_pem_init (mbedtls_pem_context *ctx) |
PEM context setup. More... | |
int | mbedtls_pem_read_buffer (mbedtls_pem_context *ctx, const char *header, const char *footer, const unsigned char *data, const unsigned char *pwd, size_t pwdlen, size_t *use_len) |
Read a buffer for PEM information and store the resulting data into the specified context buffers. More... | |
void | mbedtls_pem_free (mbedtls_pem_context *ctx) |
PEM context memory freeing. More... | |
int | mbedtls_pem_write_buffer (const char *header, const char *footer, const unsigned char *der_data, size_t der_len, unsigned char *buf, size_t buf_len, size_t *olen) |
Write a buffer of PEM information from a DER encoded buffer. More... | |
Privacy Enhanced Mail (PEM) decoding.
Definition in file pem.h.
#define MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180 |
#define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480 |
#define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400 |
#define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100 |
#define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200 |
#define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080 |
#define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380 |
#define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300 |
#define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280 |
typedef struct mbedtls_pem_context mbedtls_pem_context |
PEM context structure.
void mbedtls_pem_free | ( | mbedtls_pem_context * | ctx | ) |
PEM context memory freeing.
ctx | context to be freed |
void mbedtls_pem_init | ( | mbedtls_pem_context * | ctx | ) |
PEM context setup.
ctx | context to be initialized |
int mbedtls_pem_read_buffer | ( | mbedtls_pem_context * | ctx, |
const char * | header, | ||
const char * | footer, | ||
const unsigned char * | data, | ||
const unsigned char * | pwd, | ||
size_t | pwdlen, | ||
size_t * | use_len | ||
) |
Read a buffer for PEM information and store the resulting data into the specified context buffers.
ctx | context to use |
header | header string to seek and expect |
footer | footer string to seek and expect |
data | source data to look in (must be nul-terminated) |
pwd | password for decryption (can be NULL) |
pwdlen | length of password |
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) |
int mbedtls_pem_write_buffer | ( | const char * | header, |
const char * | footer, | ||
const unsigned char * | der_data, | ||
size_t | der_len, | ||
unsigned char * | buf, | ||
size_t | buf_len, | ||
size_t * | olen | ||
) |
Write a buffer of PEM information from a DER encoded buffer.
header | The header string to write. |
footer | The footer string to write. |
der_data | The DER data to encode. |
der_len | The length of the DER data der_data in Bytes. |
buf | The buffer to write to. |
buf_len | The length of the output buffer buf in Bytes. |
olen | The address at which to store the total length written or required (if buf_len is not enough). |
NULL
for buf
and 0
for buf_len
to request the length of the resulting PEM buffer in *olen
.der_data
and buf
buffers.0
on success. buf
isn't large enough to hold the PEM buffer. In this case, *olen
holds the required minimum size of buf
.