11181
|
1 /*
|
|
2 * Taken from RFC 2617
|
|
3 * Copyright (C) The Internet Society (1999). All Rights Reserved.
|
|
4
|
|
5 This document and translations of it may be copied and furnished to
|
|
6 others, and derivative works that comment on or otherwise explain it
|
|
7 or assist in its implementation may be prepared, copied, published
|
|
8 and distributed, in whole or in part, without restriction of any
|
|
9 kind, provided that the above copyright notice and this paragraph are
|
|
10 included on all such copies and derivative works. However, this
|
|
11 document itself may not be modified in any way, such as by removing
|
|
12 the copyright notice or references to the Internet Society or other
|
|
13 Internet organizations, except as needed for the purpose of
|
|
14 developing Internet standards in which case the procedures for
|
|
15 copyrights defined in the Internet Standards process must be
|
|
16 followed, or as required to translate it into languages other than
|
|
17 English.
|
|
18
|
|
19 The limited permissions granted above are perpetual and will not be
|
|
20 revoked by the Internet Society or its successors or assigns.
|
|
21
|
|
22 This document and the information contained herein is provided on an
|
|
23 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
|
24 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
|
25 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
|
26 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
|
27 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
28 */
|
|
29
|
|
30 #define HASHLEN 16
|
11512
|
31 typedef guchar HASH[HASHLEN];
|
11181
|
32 #define HASHHEXLEN 32
|
11512
|
33 typedef guchar HASHHEX[HASHHEXLEN+1];
|
11181
|
34 #define IN
|
|
35 #define OUT
|
|
36
|
|
37 /* calculate H(A1) as per HTTP Digest spec */
|
|
38 void DigestCalcHA1(
|
|
39 IN char * pszAlg,
|
|
40 IN char * pszUserName,
|
|
41 IN char * pszRealm,
|
|
42 IN char * pszPassword,
|
|
43 IN char * pszNonce,
|
|
44 IN char * pszCNonce,
|
|
45 OUT HASHHEX SessionKey
|
|
46 );
|
|
47
|
|
48 /* calculate request-digest/response-digest as per HTTP Digest spec */
|
|
49 void DigestCalcResponse(
|
|
50 IN HASHHEX HA1, /* H(A1) */
|
|
51 IN char * pszNonce, /* nonce from server */
|
|
52 IN char * pszNonceCount, /* 8 hex digits */
|
|
53 IN char * pszCNonce, /* client nonce */
|
|
54 IN char * pszQop, /* qop-value: "", "auth", "auth-int" */
|
|
55 IN char * pszMethod, /* method from the request */
|
|
56 IN char * pszDigestUri, /* requested URL */
|
|
57 IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
|
|
58 OUT HASHHEX Response /* request-digest or response-digest */
|
|
59 );
|