In the course of digitalization, more and more service providers and companies rely on web applications. The main aim is to offer their services to customers and website visitors. Companies and industry also use web applications internally, however, for example in services for their own employees. Sensitive data often has to be transferred securely between the systems as well. As a rule, this requires secure, encrypted transmission of data and login information.

One method of HTTP authentication has proven itself in particular. It extends the standard authentication used until now in a meaningful and capable way. With standard authentication (Basic Auth), the credentials are encoded in Base64 and therefore effectively transmitted in plain text, which is why it should only be used over HTTPS. The optimized Digest Auth, in contrast, uses hashing and authentication based on combined hash values. This offers additional security and reliability. It also establishes a multi-step exchange procedure that further strengthens data security.

How Digest Auth Works

Various authentication methods are now available on the market, such as OAuth 2.0. Depending on the area of use and the available resources, the method that best fits the respective needs is selected. HTTP Digest Auth is a simple but capable method for many application situations. On the one hand, the way it works is very simple and transparent. On the other hand, it offers sufficient protection for most security tasks with comparatively low resource consumption.

When you enter a valid URL in a browser and send it, the receiving server queries and checks your access authorization. If the resource has been declared as protected, the next step is to request the corresponding authentication from the sender. The server response header then looks like this, for example.

HTTP/1.1 401 Unauthorized
Date: Fri, 14 Dec 2018 09:22:16 GMT
WWW-Authenticate: Digest
realm="examplerealm@domain.com",
qop="auth,auth-int",
nonce="dcd90c0938b7102dd2f0e8b11d0f600bfb",
opaque="069c403ebaf95ccc f0171e9517f40e41"
...

An important element here is the WWW-Authenticate key. The value Digest requests the extended authentication method. A further important parameter is the nonce value. This value is a randomly chosen character string that is included in the hashing procedure later on. From the parameters user name, password, requested URL, HTTP method used, and the nonce value, the browser calculates a hash value. This hash value is sent back to the server in the Authorization header for authentication.

With the opaque parameter, the authentication server sends a further character string that serves as a kind of coat check ticket. The client browser should send it back unchanged. The hash value is calculated according to a defined scheme that uses 16-byte variables such as HA1 and HA2. The following sequence shows this.

Start of hash calculation =>
HA1 = MD5(username: realm: password)
HA2 = MD5(method: digestURI)
RESPONSE = MD5(HA1: nonce: HA2)

Note, however, that the user name and the password are only hashed with the MD5() method and are not encrypted. A reconstruction is therefore theoretically possible. For security reasons, the HTTPS transmission method can be used together with this method.

For the transmission, the server can also offer the client further authentication schemes, as the following list shows.

  • Anonymous contains no authentication information and therefore serves as a universal release for all requests.
  • Basic was introduced in the example above as standard authentication. A combination of user name and password must be assigned here. You can find more detailed information in our technical article on HTTP Basic Auth.
  • NTLM is another challenge-response method in which the Windows login information is used for the release.
  • Negotiate offers a choice between the NTLM scheme and the Kerberos protocol. The choice is made automatically, depending on availability.

Conclusion

Even with further login and authentication methods such as OAuth 2.0 or Single Sign-On, the standard login method HTTP Digest Auth in combination with the HTTPS protocol makes secure transmission and login procedures possible. HTTP Digest Auth uses few resources and should be sufficient for most use cases. The low overhead overall and the widespread implementation on client and server systems make it easier to use and thus also represent a certain degree of standardization.

A positive aspect is that the RFC for HTTP Digest Auth offers further functions to increase security significantly. One option is to change the nonce parameter with every request. A timestamp can also be integrated into the nonce value. The server can then check the nonce attributes of the client for currency and originality at any time. This further strengthens security and reduces the possibility of replay attacks. If these additional aspects are combined with an encrypted transmission method such as HTTPS, an adequate level of protection should be achievable.

Share LinkedIn X Email