00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef MBEDTLS_PEM_H
00052 #define MBEDTLS_PEM_H
00053
00054 #if !defined(MBEDTLS_CONFIG_FILE)
00055 #include "config.h"
00056 #else
00057 #include MBEDTLS_CONFIG_FILE
00058 #endif
00059
00060 #include <stddef.h>
00061
00068 #define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
00069 #define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100
00070 #define MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180
00071 #define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200
00072 #define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
00073 #define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300
00074 #define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380
00075 #define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
00076 #define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480
00077
00078
00079 #ifdef __cplusplus
00080 extern "C" {
00081 #endif
00082
00083 #if defined(MBEDTLS_PEM_PARSE_C)
00084
00087 typedef struct
00088 {
00089 unsigned char *buf;
00090 size_t buflen;
00091 unsigned char *info;
00092 }
00093 mbedtls_pem_context;
00094
00100 void mbedtls_pem_init( mbedtls_pem_context *ctx );
00101
00124 int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *header, const char *footer,
00125 const unsigned char *data,
00126 const unsigned char *pwd,
00127 size_t pwdlen, size_t *use_len );
00128
00134 void mbedtls_pem_free( mbedtls_pem_context *ctx );
00135 #endif
00136
00137 #if defined(MBEDTLS_PEM_WRITE_C)
00138
00154 int mbedtls_pem_write_buffer( const char *header, const char *footer,
00155 const unsigned char *der_data, size_t der_len,
00156 unsigned char *buf, size_t buf_len, size_t *olen );
00157 #endif
00158
00159 #ifdef __cplusplus
00160 }
00161 #endif
00162
00163 #endif