rfc2617.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* The source in this file is derived from the reference implementation
10  * in RFC 2617.
11  * RFC 2617 is Copyright (C) The Internet Society (1999). All Rights Reserved.
12  *
13  * The following copyright and licence statement covers all changes made to the
14  * reference implementation.
15  *
16  * Key changes to the reference implementation were:
17  * alteration to a plain C layout.
18  * Create CvtBin function
19  * Allow CalcHA1 to make use of precaculated username:password:realm hash's
20  * to prevent squid knowing the users password (idea suggested in RFC 2617).
21  */
22 
23 #ifndef SQUID_INCLUDE_RFC2617_H
24 #define SQUID_INCLUDE_RFC2617_H
25 
26 #define HASHLEN 16
27 typedef char HASH[HASHLEN];
28 #define HASHHEXLEN 32
29 typedef char HASHHEX[HASHHEXLEN + 1];
30 
31 /* calculate H(A1) as per HTTP Digest spec */
32 extern void DigestCalcHA1(
33  const char *pszAlg,
34  const char *pszUserName,
35  const char *pszRealm,
36  const char *pszPassword,
37  const char *pszNonce,
38  const char *pszCNonce,
39  HASH HA1,
40  HASHHEX SessionKey
41 );
42 
43 /* calculate request-digest/response-digest as per HTTP Digest spec */
44 extern void DigestCalcResponse(
45  const HASHHEX HA1, /* H(A1) */
46  const char *pszNonce, /* nonce from server */
47  const char *pszNonceCount, /* 8 hex digits */
48  const char *pszCNonce, /* client nonce */
49  const char *pszQop, /* qop-value: "", "auth", "auth-int" */
50  const char *pszMethod, /* method from the request */
51  const char *pszDigestUri, /* requested URL */
52  const HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
53  HASHHEX Response /* request-digest or response-digest */
54 );
55 
56 extern void CvtHex(const HASH Bin, HASHHEX Hex);
57 
58 extern void CvtBin(const HASHHEX Hex, HASH Bin);
59 
60 #endif /* SQUID_INCLUDE_RFC2617_H */
61 
#define HASHLEN
Definition: rfc2617.h:26
void CvtHex(const HASH Bin, HASHHEX Hex)
Definition: rfc2617.cc:28
void DigestCalcResponse(const HASHHEX HA1, const char *pszNonce, const char *pszNonceCount, const char *pszCNonce, const char *pszQop, const char *pszMethod, const char *pszDigestUri, const HASHHEX HEntity, HASHHEX Response)
Definition: rfc2617.cc:126
#define HASHHEXLEN
Definition: rfc2617.h:28
void CvtBin(const HASHHEX Hex, HASH Bin)
Definition: rfc2617.cc:49
char HASHHEX[HASHHEXLEN+1]
Definition: rfc2617.h:29
char HASH[HASHLEN]
Definition: rfc2617.h:27
void DigestCalcHA1(const char *pszAlg, const char *pszUserName, const char *pszRealm, const char *pszPassword, const char *pszNonce, const char *pszCNonce, HASH HA1, HASHHEX SessionKey)
Definition: rfc2617.cc:88

 

Introduction

Documentation

Support

Miscellaneous