Closed futursolo closed 4 years ago
Hi @futursolo, looking at https://tools.ietf.org/html/rfc5802 both sides only need the hashed forms of the password. In the Scramp library these are created at the beginning each time from the password. It would probably be a good idea to modify the library to accept pre-calculated hashes on either side. Would that be useful to you?
It would be very useful as I am trying to create a web application using SCRAM as the authentication mechanism.
It would be even better if scramp could support extracted hashes from passlib.hash.scram
as I am planning to use passlib to generate hashes with potential support for multiple algorithm.
https://passlib.readthedocs.io/en/stable/lib/passlib.hash.scram.html
Hi, I've created a new branch which refactors the code to allow a separate authentication database:
https://github.com/tlocke/scramp/tree/test
I've updated the examples as well. What do you think? Also, did you have any thoughts about how passlib could be integrated?
I think it looks good. Although, maybe not necessary to break backward compatibility.
I think as for passlib integration, the library should also accept hashes in binary format.
Since scram.extract_digest_info(hash, alg)
returns (salt, round, spassword), which can be used to derive store_key
and server_key
. Maybe auth_fn
return argument can be made to match that format?
Or users can calculate store_key
and server_key
in auth_fn
themselves. Either way is fine for me.
I've made a few alterations following your suggestions, see https://github.com/tlocke/scramp/tree/test
salt
, stored_key
and server_key
authentication values are now in binary rather than string form. This gives better performance and also makes it easier to integrate with passlib.make_stored_server_keys
.On the question of breaking backward compatibility, with this new branch the client is backwardly compatible, it's only the server that's changing, and I don't think many people (if any) are using the server side at the moment.
Any thoughts?
Thanks, it works like a charm.
Great, I've done a new release: https://pypi.org/project/scramp/
Thanks for your help @futursolo :-)
Not sure if this is the right place to ask this question.
According to the example in README, both
ScramServer
andScramClient
required password to perform handshake. But I thought that SCRAM only passes hashes during handshakes.Is this intended? Or am I missing something?