Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is digest authentication?

How does Digest Authentication differ from Basic Authentication other than sending credentials as plain text?

like image 832
SoftwareGeek Avatar asked Oct 05 '22 17:10

SoftwareGeek


People also ask

What is meant by Digest Authentication?

Digest authentication is a method of authentication in which a request from a potential user is received by a network server and then sent to a domain controller. The domain controller sends a special key, called a digest session key, to the server that received the original request.

What is the difference between basic and Digest Authentication?

Digest Authentication communicates credentials in an encrypted form by applying a hash function to: the username, the password, a server supplied nonce value, the HTTP method and the requested URI. Whereas Basic Authentication uses non-encrypted base64 encoding.

How do you Digest Authentication?

Specifically, digest access authentication uses the HTTP protocol, applying MD5 cryptographic hashing and a nonce value to prevent replay attacks. Hash values are affixed to the person's username and password before they are sent over the network, enabling the provider's server to authenticate the person.

What is Digest Authentication in IIS?

Microsoft provides digest authentication as a means of authenticating Web applications that are running on IIS. Digest authentication uses the Digest Access Protocol, which is a simple challenge-response mechanism for applications that are using HTTP or Simple Authentication Security Layer (SASL) based communications.


1 Answers

The main difference is that it doesn't require sending the username and password across the wire in plaintext. It is also immune to replay-attacks, as it uses a one-time number from the server.

The server gives the client a one-time use number (a nonce) that it combines with the username, realm, password and the URI request. The client runs all of those fields through an MD5 hashing method to produce a hash key.

It sends this hash key to the server along with the username and the realm to attempt to authenticate.

Server-side the same method is used to generate a hashkey, only instead of using the password typed in to the browser the server looks up the expected password for the user from its user DB. It looks up the stored password for this username, runs in through the same algorithm and compares it to what the client sent. If they match then access is granted, otherwise it can send back a 401 Unauthorized (no login or failed login) or a 403 Forbidden (access denied).

Digest authentication is standardized in RFC2617. There's a nice overview of it on Wikipedia:

You can think of it like this:

  1. Client makes request
  2. Client gets back a nonce from the server and a 401 authentication request
  3. Client sends back the following response array (username, realm, generate_md5_key(nonce, username, realm, URI, password_given_by_user_to_browser)) (yea, that's very simplified)
  4. The server takes username and realm (plus it knows the URI the client is requesting) and it looks up the password for that username. Then it goes and does its own version of generate_md5_key(nonce, username, realm, URI, password_I_have_for_this_user_in_my_db)
  5. It compares the output of generate_md5() that it got with the one the client sent, if they match the client sent the correct password. If they don't match the password sent was wrong.
like image 210
Ian C. Avatar answered Oct 07 '22 07:10

Ian C.