Mbed TLS v2.28.9
Loading...
Searching...
No Matches
pem.h
Go to the documentation of this file.
1
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9 */
10#ifndef MBEDTLS_PEM_H
11#define MBEDTLS_PEM_H
12
13#if !defined(MBEDTLS_CONFIG_FILE)
14#include "mbedtls/config.h"
15#else
16#include MBEDTLS_CONFIG_FILE
17#endif
18
19#include <stddef.h>
20
28#define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
30#define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100
32#define MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180
34#define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200
36#define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
38#define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300
40#define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380
42#define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
44#define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51#if defined(MBEDTLS_PEM_PARSE_C)
55typedef struct mbedtls_pem_context {
56 unsigned char *buf;
57 size_t buflen;
58 unsigned char *info;
59}
61
68
91int mbedtls_pem_read_buffer(mbedtls_pem_context *ctx, const char *header, const char *footer,
92 const unsigned char *data,
93 const unsigned char *pwd,
94 size_t pwdlen, size_t *use_len);
95
102#endif /* MBEDTLS_PEM_PARSE_C */
103
104#if defined(MBEDTLS_PEM_WRITE_C)
131int mbedtls_pem_write_buffer(const char *header, const char *footer,
132 const unsigned char *der_data, size_t der_len,
133 unsigned char *buf, size_t buf_len, size_t *olen);
134#endif /* MBEDTLS_PEM_WRITE_C */
135
136#ifdef __cplusplus
137}
138#endif
139
140#endif /* pem.h */
Configuration options (set of defines)
void mbedtls_pem_init(mbedtls_pem_context *ctx)
PEM context setup.
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.
struct mbedtls_pem_context mbedtls_pem_context
PEM context structure.
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.
void mbedtls_pem_free(mbedtls_pem_context *ctx)
PEM context memory freeing.
PEM context structure.
Definition pem.h:55
size_t buflen
Definition pem.h:57
unsigned char * buf
Definition pem.h:56
unsigned char * info
Definition pem.h:58