mbed TLS v2.2.0
pem.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_PEM_H
24 #define MBEDTLS_PEM_H
25 
26 #include <stddef.h>
27 
34 #define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
35 #define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100
36 #define MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180
37 #define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200
38 #define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
39 #define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300
40 #define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380
41 #define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
42 #define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480
43 /* \} name */
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 #if defined(MBEDTLS_PEM_PARSE_C)
50 
53 typedef struct
54 {
55  unsigned char *buf;
56  size_t buflen;
57  unsigned char *info;
58 }
59 mbedtls_pem_context;
60 
66 void mbedtls_pem_init( mbedtls_pem_context *ctx );
67 
90 int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *header, const char *footer,
91  const unsigned char *data,
92  const unsigned char *pwd,
93  size_t pwdlen, size_t *use_len );
94 
100 void mbedtls_pem_free( mbedtls_pem_context *ctx );
101 #endif /* MBEDTLS_PEM_PARSE_C */
102 
103 #if defined(MBEDTLS_PEM_WRITE_C)
104 
120 int mbedtls_pem_write_buffer( const char *header, const char *footer,
121  const unsigned char *der_data, size_t der_len,
122  unsigned char *buf, size_t buf_len, size_t *olen );
123 #endif /* MBEDTLS_PEM_WRITE_C */
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif /* pem.h */