25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Fix more places that needed changes after scram.erl api modifications

This commit is contained in:
Paweł Chmielowski 2020-12-04 09:20:59 +01:00
parent 0371b0f664
commit 72867f8d1e

View File

@ -754,8 +754,8 @@ is_password_scram_valid(Password, Scram) ->
_ ->
IterationCount = Scram#scram.iterationcount,
Salt = base64:decode(Scram#scram.salt),
SaltedPassword = scram:salted_password(Password, Salt, IterationCount),
StoredKey = scram:stored_key(scram:client_key(SaltedPassword)),
SaltedPassword = scram:salted_password(sha, Password, Salt, IterationCount),
StoredKey = scram:stored_key(sha, scram:client_key(sha, SaltedPassword)),
base64:decode(Scram#scram.storedkey) == StoredKey
end.
@ -766,9 +766,9 @@ password_to_scram(#scram{} = Password, _IterationCount) ->
Password;
password_to_scram(Password, IterationCount) ->
Salt = p1_rand:bytes(?SALT_LENGTH),
SaltedPassword = scram:salted_password(Password, Salt, IterationCount),
StoredKey = scram:stored_key(scram:client_key(SaltedPassword)),
ServerKey = scram:server_key(SaltedPassword),
SaltedPassword = scram:salted_password(sha, Password, Salt, IterationCount),
StoredKey = scram:stored_key(sha, scram:client_key(sha, SaltedPassword)),
ServerKey = scram:server_key(sha, SaltedPassword),
#scram{storedkey = base64:encode(StoredKey),
serverkey = base64:encode(ServerKey),
salt = base64:encode(Salt),