Subject: [http-auth] New proposal "WWW-Authentication: username=hashed"

From: Sophie Bremer <[email-masked]>
Date: Sun, 8 Dec 2013 19:43:24 +0100

Rifaat and I had some discussion about my proposals and we worked out a new one, that allows a simpler implementation.

1 Implementation

1.1 WWW-Authentication header by the server

digest-challenge  = ... | [username-processing]
username-processing = "username" "=" ( "plain" | "hashed" )

1.2 Authorization header by the client

If the WWW-Authentication header says "username=hashed", the following hashing should be made by the client.
The hashing of the username MUST be made AFTER any other hash processing.

username = H( H( username ":" realm) ":" nonce )

2 Benefits

- secure transfer of the username even without TLS
- server does not need to know the real username (i.e. email address)
- salted hashes that can be changed on the server by changing the realm

3 Discussion

There are some open points, that need discussion.

2.1 Implementation on the Server

Because of the nonce the server has to calculate for each HTTP 401 authorization the proper hash of all stored userhashes before he can find the right user.
If the server changes the nonce with each request, the calculation has to be made with every request for all stored userhashes.

I thought about cashing users of previous requests and first look there for the right user.
Maybe there is some better way to avoid intensive hash calculation with hundreds of thousands of stored users.

2.2 Compatibility with older clients

The server may accept hashed and plain usernames for compatibility reasons.
So the server has to detect a hashed username.
The first option would be to check the length (32) and the chars (0123456789abcdef).
The other option is a prefix like "hashed:0f1eacd9..." with a string length of 39.
I am not sure, which option is the best way for an implementation.

2.3 Security

I am skeptical, that the salted hashing is enough, if MD5 has been used.
Maybe MD5 should be excluded in the first place.

---

From: Rifaat Shekh-Yusef <[email-masked]>
Date: Mon, 9 Dec 2013 09:15:18 -0500

Hi Sophie,

One comment on "Section 2.2 Compatibility with older clients":

Another option is to ask the client to return the same parameter,
username=hashed, in the Authorization request if it supports this
specification.

Regards,
 Rifaat

On Sun, Dec 8, 2013 at 1:43 PM, Sophie Bremer
<[email-masked]>wrote:

> Rifaat and I had some discussion about my proposals and we worked out a
> new one, that allows a simpler implementation.
>
>
> 1 Implementation
>
> Because of the nonce the server has to calculate for each HTTP 401
> authorization the proper hash of all stored userhashes before he can find
> the right user.
> If the server changes the nonce with each request, the calculation has to
> be made with every request for all stored userhashes.
>
> _______________________________________________
> http-auth mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/http-auth
>

---

From: Sophie Bremer <[email-masked]>
Date: Mon, 9 Dec 2013 20:44:59 +0100

Hello Rifaat,

I suppose, that you suggest a separate key for the hashed value like userhash.
This would make it clear for the server, but it could get in conflict with a username "hashed".
Do you think, it is negligible?

Maybe, it's better to make an if-else-specification.
If the client supports a username hash, it sends the userhash key, else the username key will be send.

Best regards,
Sophie

On 09.12.2013, at 15:15, Rifaat Shekh-Yusef wrote:

> Another option is to ask the client to return the same parameter, username=hashed, in the Authorization request if it supports this specification.
> 
> Regards,
>  Rifaat
> 
> 
> 
> 
> 
> 
> 
> On Sun, Dec 8, 2013 at 1:43 PM, Sophie Bremer <[email-masked]> wrote:

---

From: Rifaat Shekh-Yusef <[email-masked]>
Date: Tue, 10 Dec 2013 09:46:08 -0500

How about userhash for both WWW-Authenticate and Authorization headers?

The format of the userhash could be:

userhash = "userhash" "=" ( "true" | "false" )

Regards,
 Rifaat

On Mon, Dec 9, 2013 at 2:44 PM, Sophie Bremer
<[email-masked]>wrote:

> > If the server changes the nonce with each request, the calculation has
> to be made with every request for all stored userhashes.
> >