]> git.ipfire.org Git - thirdparty/squid.git/blob - include/rfc2617.h
Merged from trunk
[thirdparty/squid.git] / include / rfc2617.h
1 /* The source in this file is derived from the reference implementation
2 * in RFC 2617.
3 * RFC 2617 is Copyright (C) The Internet Society (1999). All Rights Reserved.
4 *
5 * The following copyright and licence statement covers all changes made to the
6 * reference implementation.
7 *
8 * Key changes to the reference implementation were:
9 * alteration to a plain C layout.
10 * Create CvtBin function
11 * Allow CalcHA1 to make use of precaculated username:password:realm hash's
12 * to prevent squid knowing the users password (idea suggested in RFC 2617).
13 */
14
15 /*
16 * $Id$
17 *
18 * DEBUG:
19 * AUTHOR: RFC 2617 & Robert Collins
20 *
21 * SQUID Internet Object Cache http://squid.nlanr.net/Squid/
22 * ----------------------------------------------------------
23 *
24 * Squid is the result of efforts by numerous individuals from the
25 * Internet community. Development is led by Duane Wessels of the
26 * National Laboratory for Applied Network Research and funded by the
27 * National Science Foundation. Squid is Copyrighted (C) 1998 by
28 * the Regents of the University of California. Please see the
29 * COPYRIGHT file for full details. Squid incorporates software
30 * developed and/or copyrighted by other sources. Please see the
31 * CREDITS file for full details.
32 *
33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 2 of the License, or
36 * (at your option) any later version.
37 *
38 * This program is distributed in the hope that it will be useful,
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 * GNU General Public License for more details.
42 *
43 * You should have received a copy of the GNU General Public License
44 * along with this program; if not, write to the Free Software
45 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
46 *
47 */
48 #ifndef SQUID_RFC2617_H
49 #define SQUID_RFC2617_H
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55 #define HASHLEN 16
56 typedef char HASH[HASHLEN];
57 #define HASHHEXLEN 32
58 typedef char HASHHEX[HASHHEXLEN + 1];
59
60 /* calculate H(A1) as per HTTP Digest spec */
61 extern void DigestCalcHA1(
62 const char *pszAlg,
63 const char *pszUserName,
64 const char *pszRealm,
65 const char *pszPassword,
66 const char *pszNonce,
67 const char *pszCNonce,
68 HASH HA1,
69 HASHHEX SessionKey
70 );
71
72 /* calculate request-digest/response-digest as per HTTP Digest spec */
73 extern void DigestCalcResponse(
74 const HASHHEX HA1, /* H(A1) */
75 const char *pszNonce, /* nonce from server */
76 const char *pszNonceCount, /* 8 hex digits */
77 const char *pszCNonce, /* client nonce */
78 const char *pszQop, /* qop-value: "", "auth", "auth-int" */
79 const char *pszMethod, /* method from the request */
80 const char *pszDigestUri, /* requested URL */
81 const HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
82 HASHHEX Response /* request-digest or response-digest */
83 );
84
85 extern void CvtHex(const HASH Bin, HASHHEX Hex);
86
87 extern void CvtBin(const HASHHEX Hex, HASH Bin);
88
89 #ifdef __cplusplus
90 }
91 #endif
92 #endif /* SQUID_RFC2617_H */