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