add missing files
[heimdal.git] / lib / ntlm / heim-auth.h
blob389a1a093806e32211acd9444e3556b30e51b605
1 /*
2 * Generate challange for APOP and CRAM-MD5
3 */
5 char *
6 heim_generate_challenge(const char *hostname); /* hostname can be NULL, the local hostname is used */
8 /*
9 * APOP
12 char *
13 heim_apop_create(const char *challenge, const char *password);
15 int
16 heim_apop_verify(const char *challenge, const char *password, const char *response);
19 * CRAM-MD5
22 typedef struct heim_HMAC_MD5_STATE_s {
23 uint32_t istate[4];
24 uint32_t ostate[4];
25 } heim_CRAM_MD5_STATE;
27 typedef struct heim_cram_md5 *heim_cram_md5;
29 char *
30 heim_cram_md5_create(const char *challenge, const char *password);
32 int
33 heim_cram_md5_verify(const char *challenge, const char *password, const char *response);
35 void
36 heim_cram_md5_export(const char *password, heim_CRAM_MD5_STATE *state);
38 heim_cram_md5
39 heim_cram_md5_import(void *data, size_t len);
41 int
42 heim_cram_md5_verify_ctx(heim_cram_md5 ctx, const char *challenge, const char *response);
44 void
45 heim_cram_md5_free(heim_cram_md5 ctx);
48 * DIGEST-MD5
50 * heim_digest_t d;
52 * d = heim_digest_create(1, HEIM_DIGEST_TYPE_DIGEST_MD5_HTTP);
54 * if ((s = heim_digest_generate_challange(d)) != NULL) abort();
55 * send_to_client(s);
56 * response = read_from_client();
58 * heim_digest_parse_response(d, response);
60 * const char *user = heim_digest_get_key(d, "username");
61 * heim_digest_set_key(d, "password", "sommar17");
63 * if (heim_digest_verify(d, &response)) abort();
65 * send_to_client(response);
67 * heim_digest_release(d);
70 typedef struct heim_digest_desc *heim_digest_t;
72 heim_digest_t
73 heim_digest_create(int server, int type);
75 #define HEIM_DIGEST_TYPE_AUTO 0
76 #define HEIM_DIGEST_TYPE_RFC2069 1
77 #define HEIM_DIGEST_TYPE_MD5 2
78 #define HEIM_DIGEST_TYPE_MD5_SESS 3
80 void
81 heim_digest_init_set_key(heim_digest_t context, const char *key, const char *value);
83 const char *
84 heim_digest_generate_challenge(heim_digest_t context);
86 int
87 heim_digest_parse_challenge(heim_digest_t context, const char *challenge);
89 int
90 heim_digest_parse_response(heim_digest_t context, const char *response);
92 const char *
93 heim_digest_get_key(heim_digest_t context, const char *key);
95 int
96 heim_digest_set_key(heim_digest_t context, const char *key, const char *value);
98 void
99 heim_digest_set_user_password(heim_digest_t context, const char *password);
101 void
102 heim_digest_set_user_h1hash(heim_digest_t context, void *ptr, size_t size);
105 heim_digest_verify(heim_digest_t context, char **response);
107 const char *
108 heim_digest_create_response(heim_digest_t context);
110 void
111 heim_digest_get_session_key(heim_digest_t context, void **key, size_t *keySize);
113 void
114 heim_digest_release(heim_digest_t context);