Imported Upstream version 0.63.0
[hcoop/debian/courier-authlib.git] / cramlib.h
1 #ifndef cramlib_h
2 #define cramlib_h
3
4 #include "auth.h"
5
6 /*
7 ** Copyright 1998 - 2004 Double Precision, Inc. See COPYING for
8 ** distribution information.
9 */
10 struct cram_callback_info {
11 struct hmac_hashinfo *h;
12 char *user;
13 char *challenge;
14 char *response;
15 int (*callback_func)(struct authinfo *, void *);
16 void *callback_arg;
17 };
18
19 extern int auth_cram_callback(struct authinfo *a, void *vp);
20 /*
21 ** auth_get_cram parses out an authentication request. It checks whether
22 ** we have the requisite hash function installed, and, if so, base64decodes
23 ** the challenge and the response.
24 */
25
26 struct hmac_hashinfo;
27
28 int auth_get_cram(const char *authtype, /* authtype */
29 char *authdata, /* authdata */
30
31 struct cram_callback_info *craminfo);
32 /* Initializes craminfo */
33 /*
34 ** auth_verify_cram attempts to verify the secret cookie.
35 */
36
37 int auth_verify_cram(struct hmac_hashinfo *, /* The hash function */
38 const char *, /* The challenge */
39 const char *, /* The response */
40 const char *); /* Hashed secret, in hex */
41
42 #endif