00001
00027 #ifndef POLARSSL_PEM_H
00028 #define POLARSSL_PEM_H
00029
00030 #include <string.h>
00031
00038 #define POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
00039 #define POLARSSL_ERR_PEM_INVALID_DATA -0x1100
00040 #define POLARSSL_ERR_PEM_MALLOC_FAILED -0x1180
00041 #define POLARSSL_ERR_PEM_INVALID_ENC_IV -0x1200
00042 #define POLARSSL_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
00043 #define POLARSSL_ERR_PEM_PASSWORD_REQUIRED -0x1300
00044 #define POLARSSL_ERR_PEM_PASSWORD_MISMATCH -0x1380
00045 #define POLARSSL_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
00046 #define POLARSSL_ERR_PEM_BAD_INPUT_DATA -0x1480
00047
00048
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052
00053 #if defined(POLARSSL_PEM_PARSE_C)
00054
00057 typedef struct
00058 {
00059 unsigned char *buf;
00060 size_t buflen;
00061 unsigned char *info;
00062 }
00063 pem_context;
00064
00070 void pem_init( pem_context *ctx );
00071
00094 int pem_read_buffer( pem_context *ctx, const char *header, const char *footer,
00095 const unsigned char *data,
00096 const unsigned char *pwd,
00097 size_t pwdlen, size_t *use_len );
00098
00104 void pem_free( pem_context *ctx );
00105 #endif
00106
00107 #if defined(POLARSSL_PEM_WRITE_C)
00108
00124 int pem_write_buffer( const char *header, const char *footer,
00125 const unsigned char *der_data, size_t der_len,
00126 unsigned char *buf, size_t buf_len, size_t *olen );
00127 #endif
00128
00129 #ifdef __cplusplus
00130 }
00131 #endif
00132
00133 #endif