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 #ifndef MBEDTLS_PEM_H
00050 #define MBEDTLS_PEM_H
00051
00052 #if !defined(MBEDTLS_CONFIG_FILE)
00053 #include "config.h"
00054 #else
00055 #include MBEDTLS_CONFIG_FILE
00056 #endif
00057
00058 #include <stddef.h>
00059
00066 #define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
00067 #define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100
00068 #define MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180
00069 #define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200
00070 #define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
00071 #define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300
00072 #define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380
00073 #define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
00074 #define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480
00075
00076
00077 #ifdef __cplusplus
00078 extern "C" {
00079 #endif
00080
00081 #if defined(MBEDTLS_PEM_PARSE_C)
00082
00085 typedef struct
00086 {
00087 unsigned char *buf;
00088 size_t buflen;
00089 unsigned char *info;
00090 }
00091 mbedtls_pem_context;
00092
00098 void mbedtls_pem_init( mbedtls_pem_context *ctx );
00099
00122 int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *header, const char *footer,
00123 const unsigned char *data,
00124 const unsigned char *pwd,
00125 size_t pwdlen, size_t *use_len );
00126
00132 void mbedtls_pem_free( mbedtls_pem_context *ctx );
00133 #endif
00134
00135 #if defined(MBEDTLS_PEM_WRITE_C)
00136
00152 int mbedtls_pem_write_buffer( const char *header, const char *footer,
00153 const unsigned char *der_data, size_t der_len,
00154 unsigned char *buf, size_t buf_len, size_t *olen );
00155 #endif
00156
00157 #ifdef __cplusplus
00158 }
00159 #endif
00160
00161 #endif