00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef MBEDTLS_PEM_H
00025 #define MBEDTLS_PEM_H
00026
00027 #include <stddef.h>
00028
00035 #define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
00036 #define MBEDTLS_ERR_PEM_INVALID_DATA -0x1100
00037 #define MBEDTLS_ERR_PEM_ALLOC_FAILED -0x1180
00038 #define MBEDTLS_ERR_PEM_INVALID_ENC_IV -0x1200
00039 #define MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
00040 #define MBEDTLS_ERR_PEM_PASSWORD_REQUIRED -0x1300
00041 #define MBEDTLS_ERR_PEM_PASSWORD_MISMATCH -0x1380
00042 #define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
00043 #define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480
00044
00045
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049
00050 #if defined(MBEDTLS_PEM_PARSE_C)
00051
00054 typedef struct
00055 {
00056 unsigned char *buf;
00057 size_t buflen;
00058 unsigned char *info;
00059 }
00060 mbedtls_pem_context;
00061
00067 void mbedtls_pem_init( mbedtls_pem_context *ctx );
00068
00091 int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *header, const char *footer,
00092 const unsigned char *data,
00093 const unsigned char *pwd,
00094 size_t pwdlen, size_t *use_len );
00095
00101 void mbedtls_pem_free( mbedtls_pem_context *ctx );
00102 #endif
00103
00104 #if defined(MBEDTLS_PEM_WRITE_C)
00105
00121 int mbedtls_pem_write_buffer( const char *header, const char *footer,
00122 const unsigned char *der_data, size_t der_len,
00123 unsigned char *buf, size_t buf_len, size_t *olen );
00124 #endif
00125
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129
00130 #endif