Mbed TLS v4.1.1
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 "
tf-psa-crypto/build_info.h
"
15
#include "
mbedtls/compat-3-crypto.h
"
16
17
#include <stddef.h>
18
26
#define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
28
#define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100
30
#define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200
32
#define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
34
#define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300
36
#define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380
38
#define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
40
41
#ifdef __cplusplus
42
extern
"C"
{
43
#endif
44
45
#if defined(MBEDTLS_PEM_PARSE_C)
49
typedef
struct
mbedtls_pem_context
{
50
unsigned
char
*MBEDTLS_PRIVATE(buf);
51
size_t
MBEDTLS_PRIVATE(buflen);
52
unsigned
char
*MBEDTLS_PRIVATE(info);
53
}
54
mbedtls_pem_context
;
55
61
void
mbedtls_pem_init
(
mbedtls_pem_context
*ctx);
62
89
int
mbedtls_pem_read_buffer
(
mbedtls_pem_context
*ctx,
const
char
*header,
const
char
*footer,
90
const
unsigned
char
*data,
91
const
unsigned
char
*pwd,
92
size_t
pwdlen,
size_t
*use_len);
93
106
static
inline
const
unsigned
char
*
mbedtls_pem_get_buffer
(
mbedtls_pem_context
*ctx,
size_t
*buflen)
107
{
108
*buflen = ctx->MBEDTLS_PRIVATE(buflen);
109
return
ctx->MBEDTLS_PRIVATE(buf);
110
}
111
112
118
void
mbedtls_pem_free
(
mbedtls_pem_context
*ctx);
119
#endif
/* MBEDTLS_PEM_PARSE_C */
120
121
#if defined(MBEDTLS_PEM_WRITE_C)
148
int
mbedtls_pem_write_buffer
(
const
char
*header,
const
char
*footer,
149
const
unsigned
char
*der_data,
size_t
der_len,
150
unsigned
char
*buf,
size_t
buf_len,
size_t
*olen);
151
#endif
/* MBEDTLS_PEM_WRITE_C */
152
153
#ifdef __cplusplus
154
}
155
#endif
156
157
#endif
/* MBEDTLS_PEM_H */
compat-3-crypto.h
Compatibility definitions for MbedTLS 3.x code built with MbedTLS 4.x or TF-PSA-Crypto 1....
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:106
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.
mbedtls_pem_context
PEM context structure.
Definition
pem.h:49
build_info.h
Build-time configuration info.
tf-psa-crypto
include
mbedtls
pem.h
Generated on
for Mbed TLS v4.1.1 by
1.17.0