draft-ietf-httpauth-digest-04.txt   draft-ietf-httpauth-digest-05.txt 
HTTPAuth Working Group R. Shekh-Yusef, Ed. HTTPAuth Working Group R. Shekh-Yusef, Ed.
Internet-Draft D. Ahrens Internet-Draft D. Ahrens
Obsoletes: 2617 (if approved) Avaya Obsoletes: 2617 (if approved) Avaya
Intended Status: Standards Track S. Bremer Intended Status: Standards Track S. Bremer
Expires: July 23, 2014 Netzkonform Expires: August 16, 2014 Netzkonform
January 19, 2014 February 12, 2014
HTTP Digest Access Authentication HTTP Digest Access Authentication
draft-ietf-httpauth-digest-04 draft-ietf-httpauth-digest-05
Abstract Abstract
HTTP provides a simple challenge-response authentication mechanism HTTP provides a simple challenge-response authentication mechanism
that may be used by a server to challenge a client request and by a that may be used by a server to challenge a client request and by a
client to provide authentication information. This document defines client to provide authentication information. This document defines
the HTTP Digest Authentication scheme that may be used with the the HTTP Digest Authentication scheme that may be used with the
authentication mechanism. authentication mechanism.
Status of this Memo Status of this Memo
skipping to change at page 2, line 20 skipping to change at page 2, line 20
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Syntax Convention . . . . . . . . . . . . . . . . . . . . . . . 4 2 Syntax Convention . . . . . . . . . . . . . . . . . . . . . . . 4
3 Digest Access Authentication Scheme . . . . . . . . . . . . . . 4 2.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1 Overall Operation . . . . . . . . . . . . . . . . . . . . . 4 2.2 Algorithm Variants . . . . . . . . . . . . . . . . . . . . . 4
3.2 Representation of Digest Values . . . . . . . . . . . . . . 4 2.3 ABNF . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Digest Access Authentication Scheme . . . . . . . . . . . . . . 5
3.1 Overall Operation . . . . . . . . . . . . . . . . . . . . . 5
3.2 Representation of Digest Values . . . . . . . . . . . . . . 5
3.3 The WWW-Authenticate Response Header . . . . . . . . . . . . 5 3.3 The WWW-Authenticate Response Header . . . . . . . . . . . . 5
3.4 The Authorization Request Header . . . . . . . . . . . . . . 8 3.4 The Authorization Request Header . . . . . . . . . . . . . . 8
3.4.1 Request-Digest . . . . . . . . . . . . . . . . . . . . . 10 3.4.1 Response . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4.2 A1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.4.2 A1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4.3 A2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.4.3 A2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4.4 Username Hashing . . . . . . . . . . . . . . . . . . . . 11 3.4.4 Username Hashing . . . . . . . . . . . . . . . . . . . . 11
3.4.5 Directive Values and Quoted-String . . . . . . . . . . . 11 3.4.5 Parameter Values and Quoted-String . . . . . . . . . . . 12
3.4.6 Various Considerations . . . . . . . . . . . . . . . . . 12 3.4.6 Various Considerations . . . . . . . . . . . . . . . . . 12
3.5 The Authentication-Info Header . . . . . . . . . . . . . . . 13 3.5 The Authentication-Info Header . . . . . . . . . . . . . . . 13
3.6 Digest Operation . . . . . . . . . . . . . . . . . . . . . . 14 3.6 Digest Operation . . . . . . . . . . . . . . . . . . . . . . 15
3.7 Security Protocol Negotiation . . . . . . . . . . . . . . . 15 3.7 Security Protocol Negotiation . . . . . . . . . . . . . . . 16
3.8 Proxy-Authenticate and Proxy-Authorization . . . . . . . . . 16 3.8 Proxy-Authenticate and Proxy-Authorization . . . . . . . . . 16
3.9 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.9 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.9.1 Example with SHA2-256 and MD5 . . . . . . . . . . . . . 17 3.9.1 Example with SHA-256 and MD5 . . . . . . . . . . . . . . 17
3.9.2 Example with SHA-512-256, Charset, and Userhash . . . . 18 3.9.2 Example with SHA-512-256, Charset, and Userhash . . . . 18
4 Internationalization . . . . . . . . . . . . . . . . . . . . . . 19 4 Internationalization . . . . . . . . . . . . . . . . . . . . . . 20
5 Security Considerations . . . . . . . . . . . . . . . . . . . . 20 5 Security Considerations . . . . . . . . . . . . . . . . . . . . 20
5.1 Limitations . . . . . . . . . . . . . . . . . . . . . . . . 20 5.1 Limitations . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2 Authentication of Clients using Digest Authentication . . . 20 5.2 Authentication of Clients using Digest Authentication . . . 21
5.3 Limited Use Nonce Values . . . . . . . . . . . . . . . . . . 21 5.3 Limited Use Nonce Values . . . . . . . . . . . . . . . . . . 21
5.4 Replay Attacks . . . . . . . . . . . . . . . . . . . . . . . 21 5.4 Replay Attacks . . . . . . . . . . . . . . . . . . . . . . . 22
5.5 Weakness Created by Multiple Authentication Schemes . . . . 22 5.5 Weakness Created by Multiple Authentication Schemes . . . . 23
5.6 Online dictionary attacks . . . . . . . . . . . . . . . . . 23 5.6 Online dictionary attacks . . . . . . . . . . . . . . . . . 23
5.7 Man in the Middle . . . . . . . . . . . . . . . . . . . . . 23 5.7 Man in the Middle . . . . . . . . . . . . . . . . . . . . . 23
5.8 Chosen plaintext attacks . . . . . . . . . . . . . . . . . . 24 5.8 Chosen plaintext attacks . . . . . . . . . . . . . . . . . . 24
5.9 Precomputed dictionary attacks . . . . . . . . . . . . . . . 24 5.9 Precomputed dictionary attacks . . . . . . . . . . . . . . . 24
5.10 Batch brute force attacks . . . . . . . . . . . . . . . . . 24 5.10 Batch brute force attacks . . . . . . . . . . . . . . . . . 25
5.11 Spoofing by Counterfeit Servers . . . . . . . . . . . . . . 25 5.11 Spoofing by Counterfeit Servers . . . . . . . . . . . . . . 25
5.12 Storing passwords . . . . . . . . . . . . . . . . . . . . . 25 5.12 Storing passwords . . . . . . . . . . . . . . . . . . . . . 25
5.13 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.13 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6 IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 27 6 IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 26
6.1 HTTP Digest Hash Algorithms Registry . . . . . . . . . . . 27 6.1 HTTP Digest Hash Algorithms Registry . . . . . . . . . . . 26
6.2 Digest . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.2 Digest Scheme Registration . . . . . . . . . . . . . . . . 27
6.3 Authentication-Info Header Registration . . . . . . . . . . 27
7 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 28 7 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 28
8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.1 Normative References . . . . . . . . . . . . . . . . . . . . 28 8.1 Normative References . . . . . . . . . . . . . . . . . . . . 29
8.2 Informative References . . . . . . . . . . . . . . . . . . . 29 8.2 Informative References . . . . . . . . . . . . . . . . . . . 29
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 29 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 30
1 Introduction 1 Introduction
HTTP provides a simple challenge-response authentication mechanism HTTP provides a simple challenge-response authentication mechanism
that may be used by a server to challenge a client request and by a that may be used by a server to challenge a client request and by a
client to provide authentication information. This document defines client to provide authentication information. This document defines
the HTTP Digest Authentication scheme that may be used with the the HTTP Digest Authentication scheme that may be used with the
authentication mechanism. authentication mechanism.
The details of the challenge-response authentication mechanism are The details of the challenge-response authentication mechanism are
specified in the [HTTP-P7] document. specified in the [HTTP-P7] document.
The combination of this document with Basic [BASIC] and [HTTP-P7]
obsolete RFC2617.
1.1 Terminology 1.1 Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119]. document are to be interpreted as described in RFC 2119 [RFC2119].
2 Syntax Convention 2 Syntax Convention
2.1 Examples
In the interest of clarity and readability, the extended parameters In the interest of clarity and readability, the extended parameters
or the headers and parameters in the examples in this document might or the headers and parameters in the examples in this document might
be broken into multiple lines. Any line that is indented in this be broken into multiple lines. Any line that is indented in this
document is a continuation of the preceding line. document is a continuation of the preceding line.
2.2 Algorithm Variants
When used with the Digest mechanism, each one of the algorithms has
two variants: Session variant and non-Session variant.
The non-Session variant is denoted by "<algorithm>", e.g. "SHA-256",
and the Session variant is denoted by "<algorithm>-sess", e.g. "SHA-
256-sess".
2.3 ABNF
This specification uses the Augmented Backus-Naur Form (ABNF)
notation of [RFC5234].
3 Digest Access Authentication Scheme 3 Digest Access Authentication Scheme
3.1 Overall Operation 3.1 Overall Operation
The Digest scheme is based on a simple challenge-response paradigm. The Digest scheme is based on a simple challenge-response paradigm.
The Digest scheme challenges using a nonce value. A valid response The Digest scheme challenges using a nonce value. A valid response
contains a checksum of the username, the password, the given nonce contains a checksum of the username, the password, the given nonce
value, the HTTP method, and the requested URI. In this way, the value, the HTTP method, and the requested URI. In this way, the
password is never sent in the clear. The username and password must password is never sent in the clear. The username and password must
be prearranged in some fashion not addressed by this document. be prearranged in some fashion not addressed by this document.
3.2 Representation of Digest Values 3.2 Representation of Digest Values
An optional header allows the server to specify the algorithm used to An optional header allows the server to specify the algorithm used to
create the checksum or digest. This documents adds SHA2-256 and SHA2- create the checksum or digest. This documents adds SHA-256 and SHA-
512/256 algorithms. To maintain backwards compatibility, the MD5 512/256 algorithms. To maintain backwards compatibility, the MD5
algorithm is still supported but not recommended. algorithm is still supported but not recommended.
The size of the digest depends on the algorithm used. The bits in The size of the digest depends on the algorithm used. The bits in
the digest are converted from the most significant to the least the digest are converted from the most significant to the least
significant bit, four bits at a time to the ASCII representation as significant bit, four bits at a time to the ASCII representation as
follows. Each four bits is represented by its familiar hexadecimal follows. Each four bits is represented by its familiar hexadecimal
notation from the characters 0123456789abcdef, that is binary 0000 is notation from the characters 0123456789abcdef, that is binary 0000 is
represented by the character '0', 0001 by '1' and so on up to the represented by the character '0', 0001 by '1' and so on up to the
representation of 1111 as 'f'. If the MD5 algorithm is used to representation of 1111 as 'f'. If the MD5 algorithm is used to
calculate the digest, then the digest will be represented as 32 calculate the digest, then the digest will be represented as 32
hexadecimal characters, SHA2-256 and SHA2-512/256 by 64 hexadecimal hexadecimal characters, SHA-256 and SHA-512/256 by 64 hexadecimal
characters. characters.
3.3 The WWW-Authenticate Response Header 3.3 The WWW-Authenticate Response Header
If a server receives a request for an access-protected object, and an If a server receives a request for an access-protected object, and an
acceptable Authorization header is not sent, the server responds with acceptable Authorization header is not sent, the server responds with
a "401 Unauthorized" status code, and a WWW-Authenticate header with a "401 Unauthorized" status code, and a WWW-Authenticate header with
Digest scheme as per the framework defined above, and include some or Digest scheme as per the framework defined above, and include some or
all of the following parameters: all of the following parameters:
skipping to change at page 5, line 37 skipping to change at page 6, line 14
domain domain
A quoted, space-separated list of URIs, as specified in RFC 3986 A quoted, space-separated list of URIs, as specified in RFC 3986
[RFC3986], that define the protection space. If a URI is an [RFC3986], that define the protection space. If a URI is an
abs_path, it is relative to the canonical root URL of the server abs_path, it is relative to the canonical root URL of the server
being accessed. An absolute-URI in this list may refer to a being accessed. An absolute-URI in this list may refer to a
different server than the one being accessed. The client can use different server than the one being accessed. The client can use
this list to determine the set of URIs for which the same this list to determine the set of URIs for which the same
authentication information may be sent: any URI that has a URI in authentication information may be sent: any URI that has a URI in
this list as a prefix (after both have been made absolute) may be this list as a prefix (after both have been made absolute) may be
assumed to be in the same protection space. If this directive is assumed to be in the same protection space. If this parameter is
omitted or its value is empty, the client should assume that the omitted or its value is empty, the client should assume that the
protection space consists of all URIs on the responding server. protection space consists of all URIs on the responding server.
This directive is not meaningful in Proxy-Authenticate headers, This parameter is not meaningful in Proxy-Authenticate headers,
for which the protection space is always the entire proxy; if for which the protection space is always the entire proxy; if
present it should be ignored. present it should be ignored.
nonce nonce
A server-specified data string which should be uniquely generated A server-specified data string which should be uniquely generated
each time a 401 response is made. It is recommended that this each time a 401 response is made. It is recommended that this
string be base64 or hexadecimal data. Specifically, since the string be base64 or hexadecimal data. Specifically, since the
string is passed in the header lines as a quoted string, the string is passed in the header lines as a quoted string, the
double-quote character is not allowed. double-quote character is not allowed.
skipping to change at page 7, line 4 skipping to change at page 7, line 26
stale stale
A case-insensitive flag, indicating that the previous request from A case-insensitive flag, indicating that the previous request from
the client was rejected because the nonce value was stale. If the client was rejected because the nonce value was stale. If
stale is TRUE, the client may wish to simply retry the request stale is TRUE, the client may wish to simply retry the request
with a new encrypted response, without reprompting the user for a with a new encrypted response, without reprompting the user for a
new username and password. The server should only set stale to new username and password. The server should only set stale to
TRUE if it receives a request for which the nonce is invalid but TRUE if it receives a request for which the nonce is invalid but
with a valid digest for that nonce (indicating that the client with a valid digest for that nonce (indicating that the client
knows the correct username/password). If stale is FALSE, or knows the correct username/password). If stale is FALSE, or
anything other than TRUE, or the stale directive is not present, anything other than TRUE, or the stale parameter is not present,
the username and/or password are invalid, and new values must be the username and/or password are invalid, and new values must be
obtained. obtained.
algorithm algorithm
A string indicating a pair of algorithms used to produce the A string indicating a pair of algorithms used to produce the
digest and a checksum. If this is not present it is assumed to be digest and a checksum. If this is not present it is assumed to be
"MD5". If the algorithm is not understood, the challenge should be "MD5". If the algorithm is not understood, the challenge should be
ignored (and a different one used, if there is more than one). ignored (and a different one used, if there is more than one).
In this document the string obtained by applying the digest In this document the string obtained by applying the digest
algorithm to the data "data" with secret "secret" will be denoted algorithm to the data "data" with secret "secret" will be denoted
by KD(secret, data), and the string obtained by applying the by KD(secret, data), and the string obtained by applying the
checksum algorithm to the data "data" will be denoted H(data). The checksum algorithm to the data "data" will be denoted H(data). The
notation unq(X) means the value of the quoted-string X without the notation unq(X) means the value of the quoted-string X without the
surrounding quotes. surrounding quotes.
For the "MD5" and "MD5-sess" algorithms For "<algorithm>" and "<algorithm>-sess"
H(data) = MD5(data)
For the "SHA2-256" and "SHA2-256-sess" algorithms H(data) = <algorithm>(data)
H(data) = SHA2-256(data) and
For the "SHA2-512-256" and "SHA2-512-256-sess" algorithms KD(secret, data) = H(concat(secret, ":", data))
H(data) = SHA2-512-256(data) For example:
and For the "SHA-256" and "SHA-256-sess" algorithms
KD(secret, data) = H(concat(secret, ":", data)) H(data) = SHA-256(data)
i.e., the digest is the MD5 of the secret concatenated with a i.e., the digest is the MD5 of the secret concatenated with a
colon concatenated with the data. The "MD5-sess" algorithm is colon concatenated with the data. The "MD5-sess" algorithm is
intended to allow efficient 3rd party authentication servers; intended to allow efficient 3rd party authentication servers;
for the difference in usage, see the description in section for the difference in usage, see the description in section
3.4.2. 3.4.2.
qop-options qop
This directive is optional, but is made so only for backward This parameter is optional, but is made so only for backward
compatibility with RFC 2069 [RFC2069]; it SHOULD be used by all compatibility with RFC 2069 [RFC2069]; it SHOULD be used by all
implementations compliant with this version of the Digest scheme. implementations compliant with this version of the Digest scheme.
If present, it is a quoted string of one or more tokens indicating If present, it is a quoted string of one or more tokens indicating
the "quality of protection" values supported by the server. The the "quality of protection" values supported by the server. The
value "auth" indicates authentication; the value "auth-int" value "auth" indicates authentication; the value "auth-int"
indicates authentication with integrity protection; see the indicates authentication with integrity protection; see the
descriptions below for calculating the response directive value descriptions below for calculating the response parameter value
for the application of this choice. Unrecognized options MUST be for the application of this choice. Unrecognized options MUST be
ignored. ignored.
charset charset
This is an OPTIONAL parameter that is used by the server to This is an optional parameter that is used by the server to
indicate the encoding scheme it supports. indicate the encoding scheme it supports.
userhash userhash
This is an OPTIONAL parameter that is used by the server to This is an optional parameter that is used by the server to
indicate that it supports username hashing. Valid value are: indicate that it supports username hashing. Valid value are:
"true" or "false". "true" or "false".
3.4 The Authorization Request Header 3.4 The Authorization Request Header
The client is expected to retry the request, passing an The client is expected to retry the request, passing an
Authorization header line with Digest scheme, which is defined Authorization header line with Digest scheme, which is defined
according to the framework above. The values of the opaque and according to the framework above. The values of the opaque and
algorithm fields must be those supplied in the WWW-Authenticate algorithm fields must be those supplied in the WWW-Authenticate
response header for the entity being requested. response header for the entity being requested.
The request includes some or all of the following parameters: The request includes some or all of the following parameters:
response response
A string of the hex digits computed as a request-digest defined A string of the hex digits computed as defined below, which proves
below, which proves that the user knows a password that the user knows a password.
username username
The user's name in the specified realm. The user's name in the specified realm.
digest-uri uri
The URI from request-target of the Request-Line; duplicated here The URI from request-target of the Request-Line; duplicated here
because proxies are allowed to change the Request-Line in transit. because proxies are allowed to change the Request-Line in transit.
qop qop
Indicates what "quality of protection" the client has applied to Indicates what "quality of protection" the client has applied to
the message. If present, its value MUST be one of the alternatives the message. If present, its value MUST be one of the alternatives
the server indicated it supports in the WWW-Authenticate header. the server indicated it supports in the WWW-Authenticate header.
These values affect the computation of the request-digest. Note These values affect the computation of the response. Note that
that this is a single token, not a quoted list of alternatives as this is a single token, not a quoted list of alternatives as in
in WWW-Authenticate. This directive is optional in order to WWW-Authenticate. This parameter is optional in order to preserve
preserve backward compatibility with a minimal implementation of backward compatibility with a minimal implementation of RFC 2069
RFC 2069 [RFC2069], but SHOULD be used if the server indicated [RFC2069], but SHOULD be used if the server indicated that qop is
that qop is supported by providing a qop directive in the WWW- supported by providing a qop parameter in the WWW-Authenticate
Authenticate header field. header field.
cnonce cnonce
This MUST be specified if a qop directive is sent (see above), and This MUST be specified if a qop parameter is sent (see above), and
MUST NOT be specified if the server did not send a qop directive MUST NOT be specified if the server did not send a qop parameter
in the WWW-Authenticate header field. The cnonce-value is an in the WWW-Authenticate header field. The cnonce value is an
opaque quoted string value provided by the client and used by both opaque quoted string value provided by the client and used by both
client and server to avoid chosen plaintext attacks, to provide client and server to avoid chosen plaintext attacks, to provide
mutual authentication, and to provide some message integrity mutual authentication, and to provide some message integrity
protection. See the descriptions below of the calculation of the protection. See the descriptions below of the calculation of the
response- digest and request-digest values. rspauth and response values.
nonce-count nc
This MUST be specified if a qop directive is sent (see above), and The "nc" parameter stands for "nonce count". This MUST be
MUST NOT be specified if the server did not send a qop directive specified if a qop parameter is sent (see above), and MUST NOT be
in the WWW-Authenticate header field. The nc-value is the specified if the server did not send a qop parameter in the WWW-
hexadecimal count of the number of requests (including the current Authenticate header field. The nc value is the hexadecimal count
request) that the client has sent with the nonce value in this of the number of requests (including the current request) that the
request. For example, in the first request sent in response to a client has sent with the nonce value in this request. For
given nonce value, the client sends "nc=00000001". The purpose of example, in the first request sent in response to a given nonce
this directive is to allow the server to detect request replays by value, the client sends "nc=00000001". The purpose of this
maintaining its own copy of this count - if the same nc-value is parameter is to allow the server to detect request replays by
maintaining its own copy of this count - if the same nc value is
seen twice, then the request is a replay. See the description seen twice, then the request is a replay. See the description
below of the construction of the request-digest value. below of the construction of the response value.
charset
This OPTIONAL parameter is used by the client to indicate the
character encoding used for the username and password.
userhash userhash
This OPTIONAL parameter is used by the client to indicate that the This optional parameter is used by the client to indicate that the
username has been hashed. Valid value are: "true" or "false". username has been hashed. Valid value are: "true" or "false".
If a directive or its value is improper, or required directives are If a parameter or its value is improper, or required parameters are
missing, the proper response is 400 Bad Request. If the request- missing, the proper response is 400 Bad Request. If the request-
digest is invalid, then a login failure should be logged, since digest is invalid, then a login failure should be logged, since
repeated login failures from a single client may indicate an attacker repeated login failures from a single client may indicate an attacker
attempting to guess passwords. attempting to guess passwords.
The definition of request-digest above indicates the encoding for its The definition of response above indicates the encoding for its
value. The following definitions show how the value is computed. value. The following definitions show how the value is computed.
3.4.1 Request-Digest 3.4.1 Response
If the "qop" value is "auth" or "auth-int": If the "qop" value is "auth" or "auth-int":
request-digest = <"> < KD ( H(A1), unq(nonce-value) response = <"> < KD ( H(A1), unq(nonce)
":" nc-value ":" nc
":" unq(cnonce-value) ":" unq(cnonce)
":" unq(qop-value) ":" unq(qop)
":" H(A2) ":" H(A2)
) <"> ) <">
If the "qop" directive is not present (this construction is for If the "qop" parameter is not present (this construction is for
compatibility with RFC 2069): compatibility with RFC 2069):
request-digest = response =
<"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> <"> < KD ( H(A1), unq(nonce) ":" H(A2) ) > <">
See below for the definitions for A1 and A2. See below for the definitions for A1 and A2.
3.4.2 A1 3.4.2 A1
If the "algorithm" directive's value is "MD5", "SHA2-256", or "SHA2- If the "algorithm" parameter's value is "<algorithm>", e.g. "SHA-
512-256", then A1 is: 256", then A1 is:
A1 = unq(username-value) ":" unq(realm-value) ":" passwd A1 = unq(username) ":" unq(realm) ":" passwd
where where
passwd = < user's password > passwd = < user's password >
If the "algorithm" directive's value is "MD5-sess", "SHA2-256-sess", If the "algorithm" parameter's value is "<algorithm>-sess", e.g.
or "SHA2-512-256-sess", then A1 is calculated only once - on the "SHA-256-sess", then A1 is calculated only once - on the first
first request by the client following receipt of a WWW-Authenticate request by the client following receipt of a WWW-Authenticate
challenge from the server. It uses the server nonce from that challenge from the server. It uses the server nonce from that
challenge, and the first client nonce value to construct A1 as challenge, and the first client nonce value to construct A1 as
follows: follows:
A1 = H( unq(username-value) ":" unq(realm-value) A1 = H( unq(username) ":" unq(realm)
":" passwd ) ":" passwd )
":" unq(nonce-value) ":" unq(cnonce-value) ":" unq(nonce) ":" unq(cnonce)
This creates a 'session key' for the authentication of subsequent This creates a 'session key' for the authentication of subsequent
requests and responses which is different for each "authentication requests and responses which is different for each "authentication
session", thus limiting the amount of material hashed with any one session", thus limiting the amount of material hashed with any one
key. (Note: see further discussion of the authentication session in key. (Note: see further discussion of the authentication session in
section 3.6.) Because the server need only use the hash of the user section 3.6.) Because the server need only use the hash of the user
credentials in order to create the A1 value, this construction could credentials in order to create the A1 value, this construction could
be used in conjunction with a third party authentication service so be used in conjunction with a third party authentication service so
that the web server would not need the actual password value. The that the web server would not need the actual password value. The
specification of such a protocol is beyond the scope of this specification of such a protocol is beyond the scope of this
specification. specification.
3.4.3 A2 3.4.3 A2
If the "qop" directive's value is "auth" or is unspecified, then A2 If the "qop" parameter's value is "auth" or is unspecified, then A2
is: is:
A2 = Method ":" digest-uri-value A2 = Method ":" request-uri
If the "qop" value is "auth-int", then A2 is: If the "qop" value is "auth-int", then A2 is:
A2 = Method ":" digest-uri-value ":" H(entity-body) A2 = Method ":" request-uri ":" H(entity-body)
3.4.4 Username Hashing 3.4.4 Username Hashing
To protect the transport of the username from the client to the To protect the transport of the username from the client to the
server, the server SHOULD set the "userhash" parameter with the value server, the server SHOULD set the "userhash" parameter with the value
of "true" in the WWW-Authentication header. of "true" in the WWW-Authentication header.
If the client supports the "userhash" parameter, and the "userhash" If the client supports the "userhash" parameter, and the "userhash"
parameter value in the WWW-Authentication header is set to "true", parameter value in the WWW-Authentication header is set to "true",
then the client MUST calculate a hash of the username after any other then the client MUST calculate a hash of the username after any other
skipping to change at page 11, line 39 skipping to change at page 12, line 8
of "true" in the Authorization Request Header. If the client does not of "true" in the Authorization Request Header. If the client does not
provide the "username" as a hash value or the "userhash" parameter provide the "username" as a hash value or the "userhash" parameter
with the value of "true", the server MAY reject the request. with the value of "true", the server MAY reject the request.
The server may change the nonce value, so the client should be ready The server may change the nonce value, so the client should be ready
to recalculate the hashed username. to recalculate the hashed username.
The following is the operation that the client will take to hash the The following is the operation that the client will take to hash the
username: username:
username = H( H( username ":" realm ) ":" nonce) username = H( H( unq(username) ":" unq(realm) ) ":" unq(nonce) )
3.4.5 Directive Values and Quoted-String 3.4.5 Parameter Values and Quoted-String
Note that the value of many of the directives, such as "username- Note that the value of many of the parameters, such as "username"
value", are defined as a "quoted-string". However, the "unq" notation value, are defined as a "quoted-string". However, the "unq" notation
indicates that surrounding quotation marks are removed in forming the indicates that surrounding quotation marks are removed in forming the
string A1. Thus if the Authorization header includes the fields string A1. Thus if the Authorization header includes the fields
username="Mufasa", realm=myhost@testrealm.com username="Mufasa", realm=myhost@testrealm.com
and the user Mufasa has password "Circle Of Life" then H(A1) would be and the user Mufasa has password "Circle Of Life" then H(A1) would be
H(Mufasa:myhost@testrealm.com:Circle Of Life) with no quotation marks H(Mufasa:myhost@testrealm.com:Circle Of Life) with no quotation marks
in the digested string. in the digested string.
No white space is allowed in any of the strings to which the digest No white space is allowed in any of the strings to which the digest
skipping to change at page 12, line 37 skipping to change at page 13, line 4
any multipart content-type. any multipart content-type.
3.4.6 Various Considerations 3.4.6 Various Considerations
The "Method" value is the HTTP request method as specified in section The "Method" value is the HTTP request method as specified in section
3.1.1 of [HTTP-P1]. The "request-target" value is the request-target 3.1.1 of [HTTP-P1]. The "request-target" value is the request-target
from the request line as specified in section 3.1.1 of [HTTP-P1]. from the request line as specified in section 3.1.1 of [HTTP-P1].
This may be "*", an "absolute-URI" or an "absolute-path" as specified This may be "*", an "absolute-URI" or an "absolute-path" as specified
in section 2.7 of [HTTP-P1], but it MUST agree with the request- in section 2.7 of [HTTP-P1], but it MUST agree with the request-
target. In particular, it MUST be an "absolute-URI" if the request- target. In particular, it MUST be an "absolute-URI" if the request-
target is an "absolute-URI". The "cnonce-value" is an optional target is an "absolute-URI". The "cnonce" value is an optional
client-chosen value whose purpose is to foil chosen plaintext client-chosen value whose purpose is to foil chosen plaintext
attacks. attacks.
The authenticating server must assure that the resource designated by The authenticating server must assure that the resource designated by
the "uri" directive is the same as the resource specified in the the "uri" parameter is the same as the resource specified in the
Request-Line; if they are not, the server SHOULD return a 400 Bad Request-Line; if they are not, the server SHOULD return a 400 Bad
Request error. (Since this may be a symptom of an attack, server Request error. (Since this may be a symptom of an attack, server
implementers may want to consider logging such errors.) The purpose implementers may want to consider logging such errors.) The purpose
of duplicating information from the request URL in this field is to of duplicating information from the request URL in this field is to
deal with the possibility that an intermediate proxy may alter the deal with the possibility that an intermediate proxy may alter the
client's Request-Line. This altered (but presumably semantically client's Request-Line. This altered (but presumably semantically
equivalent) request would not result in the same digest as that equivalent) request would not result in the same digest as that
calculated by the client. calculated by the client.
Implementers should be aware of how authenticated transactions Implementers should be aware of how authenticated transactions
interact with shared caches. The HTTP/1.1 protocol specifies that interact with shared caches. The HTTP/1.1 protocol specifies that
when a shared cache (see [HTTP-P6]) has received a request containing when a shared cache (see [HTTP-P6]) has received a request containing
an Authorization header and a response from relaying that request, it an Authorization header and a response from relaying that request, it
MUST NOT return that response as a reply to any other request, unless MUST NOT return that response as a reply to any other request, unless
one of two Cache-Control (see section 3.2 of [HTTP-P6]) directives one of two Cache-Control (see section 3.2 of [HTTP-P6]) directive was
was present in the response. If the original response included the present in the response. If the original response included the "must-
"must-revalidate" Cache-Control directive, the cache MAY use the revalidate" Cache-Control directive, the cache MAY use the entity of
entity of that response in replying to a subsequent request, but MUST that response in replying to a subsequent request, but MUST first
first revalidate it with the origin server, using the request headers revalidate it with the origin server, using the request headers from
from the new request to allow the origin server to authenticate the the new request to allow the origin server to authenticate the new
new request. Alternatively, if the original response included the request. Alternatively, if the original response included the
"public" Cache-Control directive, the response entity MAY be returned "public" Cache-Control directive, the response entity MAY be returned
in reply to any subsequent request. in reply to any subsequent request.
3.5 The Authentication-Info Header 3.5 The Authentication-Info Header
The Authentication-Info header is used by the server to communicate The Authentication-Info header is used by the server to communicate
some information regarding the successful authentication in the some information regarding the successful authentication in the
response. response.
AuthenticationInfo = "Authentication-Info" ":" auth-info Authentication-Info = auth-info
auth-info = 1#(nextnonce | [ message-qop ]
| [ response-auth ] | [ cnonce ]
| [nonce-count] )
nextnonce = "nextnonce" "=" nonce-value
response-auth = "rspauth" "=" response-digest
response-digest = <"> *LHEX <">
The value of the nextnonce directive is the nonce the server wishes auth-info = *auth-param
the client to use for a future authentication response. The server
may send the Authentication-Info header with a nextnonce field as a
means of implementing one-time or otherwise changing nonces. If the
nextnonce field is present the client SHOULD use it when constructing
the Authorization header for its next request. Failure of the client
to do so may result in a request to re-authenticate from the server
with the "stale=TRUE".
Server implementations should carefully consider the performance The request includes some or all of the following parameters:
implications of the use of this mechanism; pipelined requests will
not be possible if every response includes a nextnonce directive
that must be used on the next request received by the server.
Consideration should be given to the performance vs. security
tradeoffs of allowing an old nonce value to be used for a limited
time to permit request pipelining. Use of the nonce-count can
retain most of the security advantages of a new server nonce
without the deleterious affects on pipelining.
message-qop nextnonce
The value of the nextnonce parameter is the nonce the server
wishes the client to use for a future authentication response.
The server may send the Authentication-Info header with a
nextnonce field as a means of implementing one-time or otherwise
changing nonces. If the nextnonce field is present the client
SHOULD use it when constructing the Authorization header for its
next request. Failure of the client to do so may result in a
request to re-authenticate from the server with the "stale=TRUE".
Server implementations should carefully consider the
performance implications of the use of this mechanism;
pipelined requests will not be possible if every response
includes a nextnonce parameter that must be used on the next
request received by the server. Consideration should be given
to the performance vs. security tradeoffs of allowing an old
nonce value to be used for a limited time to permit request
pipelining. Use of the "nc" parameter can retain most of the
security advantages of a new server nonce without the
deleterious affects on pipelining.
qop
Indicates the "quality of protection" options applied to the Indicates the "quality of protection" options applied to the
response by the server. The value "auth" indicates response by the server. The value "auth" indicates
authentication; the value "auth-int" indicates authentication with authentication; the value "auth-int" indicates authentication with
integrity protection. The server SHOULD use the same value for the integrity protection. The server SHOULD use the same value for the
message- qop directive in the response as was sent by the client qop parameter in the response as was sent by the client in the
in the corresponding request. corresponding request.
The optional response digest in the "response-auth" directive rspauth
supports mutual authentication -- the server proves that it knows the
user's secret, and with qop=auth-int also provides limited integrity
protection of the response. The "response-digest" value is calculated
as for the "request-digest" in the Authorization header, except that
if "qop=auth" or is not specified in the Authorization header for the
request, A2 is
A2 = ":" digest-uri-value The optional response digest in the "rspauth" parameter supports
mutual authentication -- the server proves that it knows the
user's secret, and with qop=auth-int also provides limited
integrity protection of the response. The "rspauth" value is
calculated as for the response in the Authorization header, except
that if "qop=auth" or is not specified in the Authorization header
for the request, A2 is
and if "qop=auth-int", then A2 is A2 = ":" request-uri
A2 = ":" digest-uri-value ":" H(entity-body) and if "qop=auth-int", then A2 is
where "digest-uri-value" is the value of the "uri" directive on the A2 = ":" request-uri ":" H(entity-body)
Authorization header in the request. The "cnonce-value" and "nc-
value" MUST be the ones for the client request to which this message cnonce and nc
is the response. The "response-auth", "cnonce", and "nonce-count"
directives MUST BE present if "qop=auth" or "qop=auth-int" is The "cnonce" value and "nc" value MUST be the ones for the client
specified. request to which this message is the response. The "rspauth",
"cnonce", and "nc" parameters MUST be present if "qop=auth" or
"qop=auth-int" is specified.
The Authentication-Info header is allowed in the trailer of an HTTP The Authentication-Info header is allowed in the trailer of an HTTP
message transferred via chunked transfer-coding. message transferred via chunked transfer-coding.
3.6 Digest Operation 3.6 Digest Operation
Upon receiving the Authorization header, the server may check its Upon receiving the Authorization header, the server may check its
validity by looking up the password that corresponds to the submitted validity by looking up the password that corresponds to the submitted
username. Then, the server must perform the same digest operation username. Then, the server must perform the same digest operation
(e.g., MD5) performed by the client, and compare the result to the (e.g., MD5) performed by the client, and compare the result to the
given request-digest value. given response value.
Note that the HTTP server does not actually need to know the user's Note that the HTTP server does not actually need to know the user's
cleartext password. As long as H(A1) is available to the server, the cleartext password. As long as H(A1) is available to the server, the
validity of an Authorization header may be verified. validity of an Authorization header may be verified.
The client response to a WWW-Authenticate challenge for a protection The client response to a WWW-Authenticate challenge for a protection
space starts an authentication session with that protection space. space starts an authentication session with that protection space.
The authentication session lasts until the client receives another The authentication session lasts until the client receives another
WWW-Authenticate challenge from any server in the protection space. A WWW-Authenticate challenge from any server in the protection space. A
client should remember the username, password, nonce, nonce count and client should remember the username, password, nonce, nonce count and
skipping to change at page 15, line 18 skipping to change at page 15, line 45
preemptively; doing so improves server efficiency and avoids extra preemptively; doing so improves server efficiency and avoids extra
round trips for authentication challenges. The server may choose to round trips for authentication challenges. The server may choose to
accept the old Authorization header information, even though the accept the old Authorization header information, even though the
nonce value included might not be fresh. Alternatively, the server nonce value included might not be fresh. Alternatively, the server
may return a 401 response with a new nonce value, causing the client may return a 401 response with a new nonce value, causing the client
to retry the request; by specifying stale=TRUE with this response, to retry the request; by specifying stale=TRUE with this response,
the server tells the client to retry with the new nonce, but without the server tells the client to retry with the new nonce, but without
prompting for a new username and password. prompting for a new username and password.
Because the client is required to return the value of the opaque Because the client is required to return the value of the opaque
directive given to it by the server for the duration of a session, parameter given to it by the server for the duration of a session,
the opaque data may be used to transport authentication session state the opaque data may be used to transport authentication session state
information. (Note that any such use can also be accomplished more information. (Note that any such use can also be accomplished more
easily and safely by including the state in the nonce.) For example, easily and safely by including the state in the nonce.) For example,
a server could be responsible for authenticating content that a server could be responsible for authenticating content that
actually sits on another server. It would achieve this by having the actually sits on another server. It would achieve this by having the
first 401 response include a domain directive whose value includes a first 401 response include a domain parameter whose value includes a
URI on the second server, and an opaque directive whose value URI on the second server, and an opaque parameter whose value
contains the state information. The client will retry the request, at contains the state information. The client will retry the request, at
which time the server might respond with a 301/302 redirection, which time the server might respond with a 301/302 redirection,
pointing to the URI on the second server. The client will follow the pointing to the URI on the second server. The client will follow the
redirection, and pass an Authorization header , including the redirection, and pass an Authorization header , including the
<opaque> data. <opaque> data.
As with the basic scheme, proxies must be completely transparent in As with the basic scheme, proxies must be completely transparent in
the Digest access authentication scheme. That is, they must forward the Digest access authentication scheme. That is, they must forward
the WWW-Authenticate, Authentication-Info and Authorization headers the WWW-Authenticate, Authentication-Info and Authorization headers
untouched. If a proxy wants to authenticate a client before a request untouched. If a proxy wants to authenticate a client before a request
skipping to change at page 16, line 10 skipping to change at page 16, line 38
client supports it. A client is encouraged to fail gracefully if the client supports it. A client is encouraged to fail gracefully if the
server specifies only authentication schemes it cannot handle. server specifies only authentication schemes it cannot handle.
When a server receives a request to access a resource, the server When a server receives a request to access a resource, the server
might challenge the client by responding with "401 Unauthorized" might challenge the client by responding with "401 Unauthorized"
status code, and include one or more WWW-Authenticate headers. If the status code, and include one or more WWW-Authenticate headers. If the
server challenges with multiple Digest headers, then each one of server challenges with multiple Digest headers, then each one of
these headers MUST use a different digest algorithm. The server MUST these headers MUST use a different digest algorithm. The server MUST
add these Digest headers to the response in order of preference, add these Digest headers to the response in order of preference,
starting with the most preferred header, followed by the less starting with the most preferred header, followed by the less
preferred headers. preferred headers. The preference of the algorithms is defined in the
IANA registry of the various algorithms as defined in section 6.1.
This specification defines the following preference list, starting
with the most preferred algorithm:
* SHA2-256.
* SHA2-512/256.
* MD5 (for backward compatibility).
A future version of this document might add SHA3 [SHA3] as a backup
algorithm, once its definition has been finalized and published.
When the client receives the response it SHOULD use the topmost When the client receives the response it SHOULD use the topmost
header that it supports, unless a local policy dictates otherwise. header that it supports, unless a local policy dictates otherwise.
The client should ignore any challenge it does not understand. The client should ignore any challenge it does not understand.
3.8 Proxy-Authenticate and Proxy-Authorization 3.8 Proxy-Authenticate and Proxy-Authorization
The digest authentication scheme may also be used for authenticating The digest authentication scheme may also be used for authenticating
users to proxies, proxies to proxies, or proxies to origin servers by users to proxies, proxies to proxies, or proxies to origin servers by
use of the Proxy-Authenticate and Proxy-Authorization headers. These use of the Proxy-Authenticate and Proxy-Authorization headers. These
skipping to change at page 16, line 43 skipping to change at page 17, line 16
HTTP/1.1 specification [HTTP-P7] and their behavior is subject to HTTP/1.1 specification [HTTP-P7] and their behavior is subject to
restrictions described there. The transactions for proxy restrictions described there. The transactions for proxy
authentication are very similar to those already described. Upon authentication are very similar to those already described. Upon
receiving a request which requires authentication, the proxy/server receiving a request which requires authentication, the proxy/server
must issue the "407 Proxy Authentication Required" response with a must issue the "407 Proxy Authentication Required" response with a
"Proxy-Authenticate" header. The digest-challenge used in the Proxy- "Proxy-Authenticate" header. The digest-challenge used in the Proxy-
Authenticate header is the same as that for the WWW- Authenticate Authenticate header is the same as that for the WWW- Authenticate
header as defined above in section 3.2.1. header as defined above in section 3.2.1.
The client/proxy must then re-issue the request with a Proxy- The client/proxy must then re-issue the request with a Proxy-
Authorization header, with directives as specified for the Authorization header, with parameters as specified for the
Authorization header in section 3.4 above. Authorization header in section 3.4 above.
On subsequent responses, the server sends Proxy-Authenticate-Info On subsequent responses, the server sends Proxy-Authenticate-Info
with directives the same as those for the Authentication-Info header with parameters the same as those for the Authentication-Info header
field. field.
Note that in principle a client could be asked to authenticate itself Note that in principle a client could be asked to authenticate itself
to both a proxy and an end-server, but never in the same response. to both a proxy and an end-server, but never in the same response.
3.9 Examples 3.9 Examples
3.9.1 Example with SHA2-256 and MD5 3.9.1 Example with SHA-256 and MD5
The following example assumes that an access protected document is The following example assumes that an access protected document is
being requested from the server via a GET request. The URI of the being requested from the server via a GET request. The URI of the
document is http://www.nowhere.org/dir/index.html". Both client and document is http://www.nowhere.org/dir/index.html". Both client and
server know that the username for this document is "Mufasa" and the server know that the username for this document is "Mufasa" and the
password is "Circle of Life" ( with one space between each of the password is "Circle of Life" ( with one space between each of the
three words). three words).
The first time the client requests the document, no Authorization The first time the client requests the document, no Authorization
header is sent, so the server responds with: header is sent, so the server responds with:
HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest WWW-Authenticate: Digest
realm = "testrealm@host.com", realm = "testrealm@host.com",
qop="auth, auth-int", qop="auth, auth-int",
algorithm="SHA2-256", algorithm="SHA-256",
nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
opaque="5ccc069c403ebaf9f0171e9517f40e41" opaque="5ccc069c403ebaf9f0171e9517f40e41"
WWW-Authenticate: Digest WWW-Authenticate: Digest
realm="testrealm@host.com", realm="testrealm@host.com",
qop="auth, auth-int", qop="auth, auth-int",
algorithm="MD5", algorithm="MD5",
nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
opaque="5ccc069c403ebaf9f0171e9517f40ef41" opaque="5ccc069c403ebaf9f0171e9517f40ef41"
The client may prompt the user for their username and password, after The client may prompt the user for their username and password, after
skipping to change at page 18, line 5 skipping to change at page 18, line 23
realm="testrealm@host.com", realm="testrealm@host.com",
nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
uri="/dir/index.html", uri="/dir/index.html",
qop="auth", qop="auth",
algorithm="MD5", algorithm="MD5",
nc=00000001, nc=00000001,
cnonce="0a4f113b", cnonce="0a4f113b",
response="6629fae49393a05397450978507c4ef1", response="6629fae49393a05397450978507c4ef1",
opaque="5ccc069c403ebaf9f0171e9517f40e41" opaque="5ccc069c403ebaf9f0171e9517f40e41"
If the client chooses to use the SHA2-256 algorithm for calculating If the client chooses to use the SHA-256 algorithm for calculating
the response, the client responds with a new request including the the response, the client responds with a new request including the
following Authorization header: following Authorization header:
Authorization:Digest username="Mufasa", Authorization:Digest username="Mufasa",
realm="testrealm@host.com", realm="testrealm@host.com",
nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
uri="/dir/index.html", uri="/dir/index.html",
qop="auth", qop="auth",
algorithm="SHA2-256", algorithm="SHA-256",
nc=00000001, nc=00000001,
cnonce="0a4f113b", cnonce="0a4f113b",
response="5abdd07184ba512a22c53f41470e5eea7dcaa3a93 response="5abdd07184ba512a22c53f41470e5eea7dcaa3a93
a59b630c13dfe0a5dc6e38b", a59b630c13dfe0a5dc6e38b",
opaque="5ccc069c403ebaf9f0171e9517f40e41" opaque="5ccc069c403ebaf9f0171e9517f40e41"
3.9.2 Example with SHA-512-256, Charset, and Userhash 3.9.2 Example with SHA-512-256, Charset, and Userhash
The following example assumes that an access protected document is The following example assumes that an access protected document is
being requested from the server via a GET request. The URI for the being requested from the server via a GET request. The URI for the
skipping to change at page 19, line 21 skipping to change at page 19, line 40
nonce="e145a96d70d40739596e60c6340f13be03290bd73c676d nonce="e145a96d70d40739596e60c6340f13be03290bd73c676d
3f25c01271af522eb2", 3f25c01271af522eb2",
nc=00000001, nc=00000001,
cnonce="cde966df34a49d5d842a263604159141c81db8d468e1bf cnonce="cde966df34a49d5d842a263604159141c81db8d468e1bf
657230429424fc337a", 657230429424fc337a",
qop=auth, qop=auth,
response="ec180fc03b7a0dcd43c414f66f2335399bbe5f4d4ad469 response="ec180fc03b7a0dcd43c414f66f2335399bbe5f4d4ad469
f8233106ba453213c8", f8233106ba453213c8",
opaque="192cbcf2a2576846522c1a367c1dfdf0359a87719c5cc1 opaque="192cbcf2a2576846522c1a367c1dfdf0359a87719c5cc1
839e4f3d2ffeb82517", 839e4f3d2ffeb82517",
charset=UTF-8,
userhash=true userhash=true
If the client can not provide a hashed username for any reason, the If the client can not provide a hashed username for any reason, the
client may try a request with this Authorization header: client may try a request with this Authorization header:
Authorization: Digest Authorization: Digest
username="Jason Doe", username="Jason Doe",
realm="api@example.org", realm="api@example.org",
uri="/doe.json", uri="/doe.json",
algorithm=SHA-512-256, algorithm=SHA-512-256,
nonce="e145a96d70d40739596e60c6340f13be03290bd73c676d nonce="e145a96d70d40739596e60c6340f13be03290bd73c676d
3f25c01271af522eb2", 3f25c01271af522eb2",
nc=00000001, nc=00000001,
cnonce="cde966df34a49d5d842a263604159141c81db8d468e1bf cnonce="cde966df34a49d5d842a263604159141c81db8d468e1bf
657230429424fc337a", 657230429424fc337a",
qop=auth, qop=auth,
response="ec180fc03b7a0dcd43c414f66f2335399bbe5f4d4ad469 response="ec180fc03b7a0dcd43c414f66f2335399bbe5f4d4ad469
f8233106ba453213c8", f8233106ba453213c8",
opaque="192cbcf2a2576846522c1a367c1dfdf0359a87719c5cc1 opaque="192cbcf2a2576846522c1a367c1dfdf0359a87719c5cc1
839e4f3d2ffeb82517", 839e4f3d2ffeb82517",
charset=UTF-8,
userhash=false userhash=false
4 Internationalization 4 Internationalization
In challenges, servers SHOULD use the "charset" authentication In challenges, servers SHOULD use the "charset" authentication
parameter (case-insensitive) to express the character encoding they parameter (case-insensitive) to express the character encoding they
expect the user agent to use. expect the user agent to use when generating A1 (see section 3.4.2)
and username hashing (see section 3.4.4).
The only allowed value is "UTF-8", to be matched case-insensitively, The only allowed value is "UTF-8", to be matched case-insensitively,
indicating that the server expects the UTF-8 character encoding to be indicating that the server expects the UTF-8 character encoding to be
used ([RFC3629]). used ([RFC3629]).
If the user agent supports the encoding indicated by the server, it
MAY add the "charset" parameter, with the value it received from the
server, to the Proxy-Authenticate or WWW-Authenticate header fields
it sends back to the server.
If the user agent does not support the encoding indicated by the If the user agent does not support the encoding indicated by the
server, it MUST fail the request. server, it MUST fail the request.
5 Security Considerations 5 Security Considerations
5.1 Limitations 5.1 Limitations
HTTP Digest authentication, when used with human-memorable passwords, HTTP Digest authentication, when used with human-memorable passwords,
is vulnerable to dictionary attacks. Such attacks are much easier is vulnerable to dictionary attacks. Such attacks are much easier
than cryptographic attacks on any widely used algorithm, including than cryptographic attacks on any widely used algorithm, including
skipping to change at page 21, line 5 skipping to change at page 21, line 22
[RFC2195]). It is intended to replace the much weaker and even more [RFC2195]). It is intended to replace the much weaker and even more
dangerous Basic mechanism. dangerous Basic mechanism.
Digest Authentication offers no confidentiality protection beyond Digest Authentication offers no confidentiality protection beyond
protecting the actual username and password. All of the rest of the protecting the actual username and password. All of the rest of the
request and response are available to an eavesdropper. request and response are available to an eavesdropper.
Digest Authentication offers only limited integrity protection for Digest Authentication offers only limited integrity protection for
the messages in either direction. If qop=auth-int mechanism is used, the messages in either direction. If qop=auth-int mechanism is used,
those parts of the message used in the calculation of the WWW- those parts of the message used in the calculation of the WWW-
Authenticate and Authorization header field response directive values Authenticate and Authorization header field response parameter values
(see section 3.2 above) are protected. Most header fields and their (see section 3.2 above) are protected. Most header fields and their
values could be modified as a part of a man-in-the-middle attack. values could be modified as a part of a man-in-the-middle attack.
Many needs for secure HTTP transactions cannot be met by Digest Many needs for secure HTTP transactions cannot be met by Digest
Authentication. For those needs TLS or SHTTP are more appropriate Authentication. For those needs TLS or SHTTP are more appropriate
protocols. In particular Digest authentication cannot be used for any protocols. In particular Digest authentication cannot be used for any
transaction requiring confidentiality protection. Nevertheless many transaction requiring confidentiality protection. Nevertheless many
functions remain for which Digest authentication is both useful and functions remain for which Digest authentication is both useful and
appropriate. appropriate.
5.3 Limited Use Nonce Values 5.3 Limited Use Nonce Values
The Digest scheme uses a server-specified nonce to seed the The Digest scheme uses a server-specified nonce to seed the
generation of the request-digest value (as specified in section generation of the response value (as specified in section 3.4.1
3.2.2.1 above). As shown in the example nonce in section 3.2.1, the above). As shown in the example nonce in section 3.2.1, the server
server is free to construct the nonce such that it may only be used is free to construct the nonce such that it may only be used from a
from a particular client, for a particular resource, for a limited particular client, for a particular resource, for a limited period of
period of time or number of uses, or any other restrictions. Doing time or number of uses, or any other restrictions. Doing so
so strengthens the protection provided against, for example, replay strengthens the protection provided against, for example, replay
attacks (see 4.5). However, it should be noted that the method attacks (see 4.5). However, it should be noted that the method
chosen for generating and checking the nonce also has performance and chosen for generating and checking the nonce also has performance and
resource implications. For example, a server may choose to allow resource implications. For example, a server may choose to allow
each nonce value to be used only once by maintaining a record of each nonce value to be used only once by maintaining a record of
whether or not each recently issued nonce has been returned and whether or not each recently issued nonce has been returned and
sending a next-nonce directive in the Authentication-Info header sending a next-nonce parameter in the Authentication-Info header
field of every response. This protects against even an immediate field of every response. This protects against even an immediate
replay attack, but has a high cost checking nonce values, and perhaps replay attack, but has a high cost checking nonce values, and perhaps
more important will cause authentication failures for any pipelined more important will cause authentication failures for any pipelined
requests (presumably returning a stale nonce indication). Similarly, requests (presumably returning a stale nonce indication). Similarly,
incorporating a request-specific element such as the Etag value for a incorporating a request-specific element such as the Etag value for a
resource limits the use of the nonce to that version of the resource resource limits the use of the nonce to that version of the resource
and also defeats pipelining. Thus it may be useful to do so for and also defeats pipelining. Thus it may be useful to do so for
methods with side effects but have unacceptable performance for those methods with side effects but have unacceptable performance for those
that do not. that do not.
skipping to change at page 24, line 18 skipping to change at page 24, line 32
With Digest authentication, a MITM or a malicious server can With Digest authentication, a MITM or a malicious server can
arbitrarily choose the nonce that the client will use to compute the arbitrarily choose the nonce that the client will use to compute the
response. This is called a "chosen plaintext" attack. The ability to response. This is called a "chosen plaintext" attack. The ability to
choose the nonce is known to make cryptanalysis much easier. choose the nonce is known to make cryptanalysis much easier.
However, no way to analyze the MD5 one-way function used by Digest However, no way to analyze the MD5 one-way function used by Digest
using chosen plaintext is currently known. using chosen plaintext is currently known.
The countermeasure against this attack is for clients to be The countermeasure against this attack is for clients to be
configured to require the use of the optional "cnonce" directive; configured to require the use of the optional "cnonce" parameter;
this allows the client to vary the input to the hash in a way not this allows the client to vary the input to the hash in a way not
chosen by the attacker. chosen by the attacker.
5.9 Precomputed dictionary attacks 5.9 Precomputed dictionary attacks
With Digest authentication, if the attacker can execute a chosen With Digest authentication, if the attacker can execute a chosen
plaintext attack, the attacker can precompute the response for many plaintext attack, the attacker can precompute the response for many
common words to a nonce of its choice, and store a dictionary of common words to a nonce of its choice, and store a dictionary of
(response, password) pairs. Such precomputation can often be done in (response, password) pairs. Such precomputation can often be done in
parallel on many machines. It can then use the chosen plaintext parallel on many machines. It can then use the chosen plaintext
attack to acquire a response corresponding to that challenge, and attack to acquire a response corresponding to that challenge, and
just look up the password in the dictionary. Even if most passwords just look up the password in the dictionary. Even if most passwords
are not in the dictionary, some might be. Since the attacker gets to are not in the dictionary, some might be. Since the attacker gets to
pick the challenge, the cost of computing the response for each pick the challenge, the cost of computing the response for each
password on the list can be amortized over finding many passwords. A password on the list can be amortized over finding many passwords. A
dictionary with 100 million password/response pairs would take about dictionary with 100 million password/response pairs would take about
3.2 gigabytes of disk storage. 3.2 gigabytes of disk storage.
The countermeasure against this attack is to for clients to be The countermeasure against this attack is to for clients to be
configured to require the use of the optional "cnonce" directive. configured to require the use of the optional "cnonce" parameter.
5.10 Batch brute force attacks 5.10 Batch brute force attacks
With Digest authentication, a MITM can execute a chosen plaintext With Digest authentication, a MITM can execute a chosen plaintext
attack, and can gather responses from many users to the same nonce. attack, and can gather responses from many users to the same nonce.
It can then find all the passwords within any subset of password It can then find all the passwords within any subset of password
space that would generate one of the nonce/response pairs in a single space that would generate one of the nonce/response pairs in a single
pass over that space. It also reduces the time to find the first pass over that space. It also reduces the time to find the first
password by a factor equal to the number of nonce/response pairs password by a factor equal to the number of nonce/response pairs
gathered. This search of the password space can often be done in gathered. This search of the password space can often be done in
parallel on many machines, and even a single machine can search large parallel on many machines, and even a single machine can search large
subsets of the password space very quickly -- reports exist of subsets of the password space very quickly -- reports exist of
searching all passwords with six or fewer letters in a few hours. searching all passwords with six or fewer letters in a few hours.
The countermeasure against this attack is to for clients to be The countermeasure against this attack is to for clients to be
configured to require the use of the optional "cnonce" directive. configured to require the use of the optional "cnonce" parameter.
5.11 Spoofing by Counterfeit Servers 5.11 Spoofing by Counterfeit Servers
Basic Authentication is vulnerable to spoofing by counterfeit Basic Authentication is vulnerable to spoofing by counterfeit
servers. If a user can be led to believe that she is connecting to a servers. If a user can be led to believe that she is connecting to a
host containing information protected by a password she knows, when host containing information protected by a password she knows, when
in fact she is connecting to a hostile server, then the hostile in fact she is connecting to a hostile server, then the hostile
server can request a password, store it away for later use, and feign server can request a password, store it away for later use, and feign
an error. This type of attack is more difficult with Digest an error. This type of attack is more difficult with Digest
Authentication -- but the client must know to demand that Digest Authentication -- but the client must know to demand that Digest
skipping to change at page 27, line 20 skipping to change at page 27, line 13
Hash Algorithms". When registering a new hash algorithm, the Hash Algorithms". When registering a new hash algorithm, the
following information MUST be provided: following information MUST be provided:
o Hash Algorithm o Hash Algorithm
The textual name of the hash algorithm. The textual name of the hash algorithm.
o Digest Size o Digest Size
The size of the algorithm's output in hexadecimal characters. The size of the algorithm's output in hexadecimal characters.
o Preference o Preference
The preference of the algorithm, with zero being the least The preference of the algorithm, with 1.0 being the least
preferred. preferred. This is a real number to allow for future algorithms
to be added anywhere in the table.
o Reference o Reference
A reference to the specification that describes the new algorithm. A reference to the specification that describes the new algorithm.
The update policy for this registry shall be Specification Required. The update policy for this registry shall be Specification Required.
The initial registry will contain the following entries: The initial registry will contain the following entries:
Hash Algorithm Digest Size Preference Reference Hash Algorithm Digest Size Preference Reference
-------------- ----------- ---------- --------- -------------- ----------- ---------- ---------
"MD5" 32 0 RFC XXXX "MD5" 32 1.0 RFC XXXX
"SHA2-512-256" 64 1 RFC XXXX "SHA-512-256" 64 2.0 RFC XXXX
"SHA2-256" 64 2 RFC XXXX "SHA-256" 64 3.0 RFC XXXX
Each one of the algorithms defined in the registry might have a -sess Each one of the algorithms defined in the registry might have a -sess
variant, e.g. MD5-sess, SHA2-256-sess, etc. variant, e.g. MD5-sess, SHA-256-sess, etc.
6.2 Digest 6.2 Digest Scheme Registration
This specification registers the Digest scheme with the This specification registers the Digest scheme with the
Authentication Scheme Registry. Authentication Scheme Registry.
Authentication Scheme Name: Digest Authentication Scheme Name: Digest
Pointer to specification text: RFCXXX Pointer to specification text: RFCXXX
6.3 Authentication-Info Header Registration
This specification registers the Authentication-Info Header with the
Message Header Field Registry.
Header Field Name: Authentication-Info
Protocol: http
Status: standard
Reference: RFCXXXX, Section 3.5
7 Acknowledgments 7 Acknowledgments
TODO The authors of this document would like to thank the authors of
RFC2617, as this document heavily borrows text from their document to
provide a complete description of the digest scheme and its
operations.
The authors would like to thank Stephen Farrell, Yoav Nir, Phillip
Hallam-Baker, Manu Sporny, Paul Hoffman, Julian Reschke, Yaron
Sheffer, Sean Turner, Geoff Baskwill, Eric Cooper, Bjoern Hoehrmann,
Martin Durst, Peter Saint-Andre, Michael Sweet, Daniel Stenberg, and
Brett Tate for their careful review and comments.
The authors would like to thank Jonathan Stoke, Nico Williams, Harry
Halpin, and Phil Hunt for their comments on the mailing list when
discussing various aspects of this document.
The authors would like to thank Paul Kyzivat and Dale Worley for
their careful review and feedback on some aspects of this document.
8 References 8 References
8.1 Normative References 8.1 Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, RFC 3629, November 2003. 10646", STD 63, RFC 3629, November 2003.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, Resource Identifier (URI): Generic Syntax", STD 66,
RFC 3986, January 2005. RFC 3986, January 2005.
[RFC4513] Harrison, R., Ed., "Lightweight Directory Access Protocol [RFC4513] Harrison, R., Ed., "Lightweight Directory Access Protocol
(LDAP): Authentication Methods and Security Mechanisms", (LDAP): Authentication Methods and Security Mechanisms",
RFC 4513, June 2006. RFC 4513, June 2006.
[RFC5234] Crocker, D., Ed., and P. Overell, "Augmented BNF for
Syntax Specifications: ABNF", STD 68, RFC 5234, January
2008.
[HTTP-P1] Fielding, R., Reschke, J., "Hypertext Transfer Protocol [HTTP-P1] Fielding, R., Reschke, J., "Hypertext Transfer Protocol
(HTTP/1.1): Message Syntax and Routing", Work in Progress, (HTTP/1.1): Message Syntax and Routing", Work in Progress,
November 2013. November 2013.
[HTTP-P6] Fielding, R., Nottingham, M., Reschke, J., "Hypertext [HTTP-P6] Fielding, R., Nottingham, M., Reschke, J., "Hypertext
Transfer Protocol (HTTP/1.1): Caching", Work in Progress, Transfer Protocol (HTTP/1.1): Caching", Work in Progress,
November 2013. November 2013.
[HTTP-P7] Fielding, R., Reschke, J., "Hypertext Transfer Protocol [HTTP-P7] Fielding, R., Reschke, J., "Hypertext Transfer Protocol
(HTTP/1.1): Authentication", Work in Progress, November (HTTP/1.1): Authentication", Work in Progress, November
2013. 2013.
[BASIC] Reschke, J., "The 'Basic' HTTP Authentication Scheme",
Work in Progress, September 2013.
8.2 Informative References 8.2 Informative References
[RFC2069] Franks, J., Hallam-Baker, P., Hostetler, J., Leach, P., [RFC2069] Franks, J., Hallam-Baker, P., Hostetler, J., Leach, P.,
Luotonen, A., Sink, E., and L. Stewart, "An Extension to Luotonen, A., Sink, E., and L. Stewart, "An Extension to
HTTP : Digest Access Authentication", RFC 2069, January HTTP : Digest Access Authentication", RFC 2069, January
1997. 1997.
[RFC2195] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP [RFC2195] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP
AUTHorize Extension for Simple Challenge/Response", AUTHorize Extension for Simple Challenge/Response",
RFC 2195, September 1997. RFC 2195, September 1997.
[RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.
[SHA3] "SHA-3 STANDARDIZATION"
http://csrc.nist.gov/groups/ST/hash/sha-3/sha-3_standardization.html
Authors' Addresses Authors' Addresses
Rifaat Shekh-Yusef (Editor) Rifaat Shekh-Yusef (Editor)
Avaya Avaya
250 Sydney Street 250 Sydney Street
Belleville, Ontario Belleville, Ontario
Canada Canada
Phone: +1-613-967-5267 Phone: +1-613-967-5267
Email: rifaat.ietf@gmail.com Email: rifaat.ietf@gmail.com
 End of changes. 100 change blocks. 
201 lines changed or deleted 240 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/