Mbed TLS v3.6.7
Toggle main menu visibility
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
#include "
mbedtls/private_access.h
"
13
14
#include "
mbedtls/build_info.h
"
15
16
#include <stddef.h>
17
25
#define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
27
#define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100
29
#define MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180
31
#define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200
33
#define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
35
#define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300
37
#define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380
39
#define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
41
#define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480
43
44
#ifdef __cplusplus
45
extern
"C"
{
46
#endif
47
48
#if defined(MBEDTLS_PEM_PARSE_C)
52
typedef
struct
mbedtls_pem_context
{
53
unsigned
char
*
MBEDTLS_PRIVATE
(buf);
54
size_t
MBEDTLS_PRIVATE
(buflen);
55
unsigned
char
*
MBEDTLS_PRIVATE
(info);
56
}
57
mbedtls_pem_context
;
58
64
void
mbedtls_pem_init
(
mbedtls_pem_context
*ctx);
65
92
int
mbedtls_pem_read_buffer
(
mbedtls_pem_context
*ctx,
const
char
*header,
const
char
*footer,
93
const
unsigned
char
*data,
94
const
unsigned
char
*pwd,
95
size_t
pwdlen,
size_t
*use_len);
96
109
static
inline
const
unsigned
char
*
mbedtls_pem_get_buffer
(
mbedtls_pem_context
*ctx,
size_t
*buflen)
110
{
111
*buflen = ctx->MBEDTLS_PRIVATE(buflen);
112
return
ctx->MBEDTLS_PRIVATE(buf);
113
}
114
115
121
void
mbedtls_pem_free
(
mbedtls_pem_context
*ctx);
122
#endif
/* MBEDTLS_PEM_PARSE_C */
123
124
#if defined(MBEDTLS_PEM_WRITE_C)
151
int
mbedtls_pem_write_buffer
(
const
char
*header,
const
char
*footer,
152
const
unsigned
char
*der_data,
size_t
der_len,
153
unsigned
char
*buf,
size_t
buf_len,
size_t
*olen);
154
#endif
/* MBEDTLS_PEM_WRITE_C */
155
156
#ifdef __cplusplus
157
}
158
#endif
159
160
#endif
/* pem.h */
build_info.h
Build-time configuration info.
mbedtls_pem_init
void mbedtls_pem_init(mbedtls_pem_context *ctx)
PEM context setup.
mbedtls_pem_write_buffer
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.
mbedtls_pem_get_buffer
static const unsigned char * mbedtls_pem_get_buffer(mbedtls_pem_context *ctx, size_t *buflen)
Get the pointer to the decoded binary data in a PEM context.
Definition
pem.h:109
mbedtls_pem_read_buffer
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.
mbedtls_pem_free
void mbedtls_pem_free(mbedtls_pem_context *ctx)
PEM context memory freeing.
private_access.h
Macro wrapper for struct's members.
MBEDTLS_PRIVATE
#define MBEDTLS_PRIVATE(member)
Definition
private_access.h:15
mbedtls_pem_context
PEM context structure.
Definition
pem.h:52
include
mbedtls
pem.h
Generated on
for Mbed TLS v3.6.7 by
1.17.0