etc/services - sync with NetBSD-8
[minix.git] / crypto / external / bsd / heimdal / dist / lib / ntlm / heim-auth.h
blobc8e47955be3f6731af0c900731dbe11d981b08a2
1 /* $NetBSD: heim-auth.h,v 1.1.1.2 2014/04/24 12:45:51 pettai Exp $ */
3 /*
4 * Generate challange for APOP and CRAM-MD5
5 */
7 char *
8 heim_generate_challenge(const char *hostname); /* hostname can be NULL, the local hostname is used */
11 * APOP
14 char *
15 heim_apop_create(const char *challenge, const char *password);
17 int
18 heim_apop_verify(const char *challenge, const char *password, const char *response);
21 * CRAM-MD5
24 typedef struct heim_HMAC_MD5_STATE_s {
25 uint32_t istate[4];
26 uint32_t ostate[4];
27 } heim_CRAM_MD5_STATE;
29 typedef struct heim_cram_md5 *heim_cram_md5;
31 char *
32 heim_cram_md5_create(const char *challenge, const char *password);
34 int
35 heim_cram_md5_verify(const char *challenge, const char *password, const char *response);
37 void
38 heim_cram_md5_export(const char *password, heim_CRAM_MD5_STATE *state);
40 heim_cram_md5
41 heim_cram_md5_import(void *data, size_t len);
43 int
44 heim_cram_md5_verify_ctx(heim_cram_md5 ctx, const char *challenge, const char *response);
46 void
47 heim_cram_md5_free(heim_cram_md5 ctx);
50 * DIGEST-MD5
52 * heim_digest_t d;
54 * d = heim_digest_create(1, HEIM_DIGEST_TYPE_DIGEST_MD5_HTTP);
56 * if ((s = heim_digest_generate_challange(d)) != NULL) abort();
57 * send_to_client(s);
58 * response = read_from_client();
60 * heim_digest_parse_response(d, response);
62 * const char *user = heim_digest_get_key(d, "username");
63 * heim_digest_set_key(d, "password", "sommar17");
65 * if (heim_digest_verify(d, &response)) abort();
67 * send_to_client(response);
69 * heim_digest_release(d);
72 typedef struct heim_digest_desc *heim_digest_t;
74 heim_digest_t
75 heim_digest_create(int server, int type);
77 #define HEIM_DIGEST_TYPE_AUTO 0
78 #define HEIM_DIGEST_TYPE_RFC2069 1
79 #define HEIM_DIGEST_TYPE_MD5 2
80 #define HEIM_DIGEST_TYPE_MD5_SESS 3
82 void
83 heim_digest_init_set_key(heim_digest_t context, const char *key, const char *value);
85 const char *
86 heim_digest_generate_challenge(heim_digest_t context);
88 int
89 heim_digest_parse_challenge(heim_digest_t context, const char *challenge);
91 int
92 heim_digest_parse_response(heim_digest_t context, const char *response);
94 const char *
95 heim_digest_get_key(heim_digest_t context, const char *key);
97 int
98 heim_digest_set_key(heim_digest_t context, const char *key, const char *value);
100 void
101 heim_digest_set_user_password(heim_digest_t context, const char *password);
103 void
104 heim_digest_set_user_h1hash(heim_digest_t context, void *ptr, size_t size);
107 heim_digest_verify(heim_digest_t context, char **response);
109 const char *
110 heim_digest_create_response(heim_digest_t context);
112 void
113 heim_digest_get_session_key(heim_digest_t context, void **key, size_t *keySize);
115 void
116 heim_digest_release(heim_digest_t context);