PolarSSL v1.3.2
pem.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_PEM_H
28 #define POLARSSL_PEM_H
29 
30 #include <string.h>
31 
38 #define POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080
39 #define POLARSSL_ERR_PEM_INVALID_DATA -0x1100
40 #define POLARSSL_ERR_PEM_MALLOC_FAILED -0x1180
41 #define POLARSSL_ERR_PEM_INVALID_ENC_IV -0x1200
42 #define POLARSSL_ERR_PEM_UNKNOWN_ENC_ALG -0x1280
43 #define POLARSSL_ERR_PEM_PASSWORD_REQUIRED -0x1300
44 #define POLARSSL_ERR_PEM_PASSWORD_MISMATCH -0x1380
45 #define POLARSSL_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
46 #define POLARSSL_ERR_PEM_BAD_INPUT_DATA -0x1480
47 /* \} name */
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 #if defined(POLARSSL_PEM_PARSE_C)
54 
57 typedef struct
58 {
59  unsigned char *buf;
60  size_t buflen;
61  unsigned char *info;
62 }
63 pem_context;
64 
70 void pem_init( pem_context *ctx );
71 
94 int pem_read_buffer( pem_context *ctx, const char *header, const char *footer,
95  const unsigned char *data,
96  const unsigned char *pwd,
97  size_t pwdlen, size_t *use_len );
98 
104 void pem_free( pem_context *ctx );
105 #endif /* POLARSSL_PEM_PARSE_C */
106 
107 #if defined(POLARSSL_PEM_WRITE_C)
108 
124 int pem_write_buffer( const char *header, const char *footer,
125  const unsigned char *der_data, size_t der_len,
126  unsigned char *buf, size_t buf_len, size_t *olen );
127 #endif /* POLARSSL_PEM_WRITE_C */
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif /* pem.h */