libidav/crypto.h

changeset 470
6bf798ad3aec
parent 404
5c08b8e14df8
child 478
baa63fef5c5c
equal deleted inserted replaced
469:6ab1f4ad2835 470:6bf798ad3aec
65 65
66 #ifdef __cplusplus 66 #ifdef __cplusplus
67 extern "C" { 67 extern "C" {
68 #endif 68 #endif
69 69
70 #define DAV_PWFUNC_PBKDF2_SHA256 0
71 #define DAV_PWFUNC_PBKDF2_SHA512 1
72
73 #define DAV_CRYPTO_ITERATION_COUNT 4000
74
70 typedef struct { 75 typedef struct {
71 DAV_AES_CTX ctx; 76 DAV_AES_CTX ctx;
72 DAV_SHA_CTX sha256; 77 DAV_SHA_CTX sha256;
73 void *stream; 78 void *stream;
74 dav_write_func write; 79 dav_write_func write;
107 112
108 void dav_get_hash(DAV_SHA_CTX *sha256, unsigned char *buf); 113 void dav_get_hash(DAV_SHA_CTX *sha256, unsigned char *buf);
109 114
110 char* dav_create_hash(const char *data, size_t len); 115 char* dav_create_hash(const char *data, size_t len);
111 116
117 DavKey* dav_pw2key(const char *password, const char *salt, int saltlen, int pwfunc, int enc);
118
119 UcxBuffer* aes_encrypt_buffer(UcxBuffer *buf, DavKey *key);
120 UcxBuffer* aes_decrypt_buffer(UcxBuffer *buf, DavKey *key);
121
112 #ifdef __cplusplus 122 #ifdef __cplusplus
113 } 123 }
114 #endif 124 #endif
115 125
116 #endif /* DAV_CRYPTO_H */ 126 #endif /* DAV_CRYPTO_H */

mercurial