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
1 changed files with 5 additions and 5 deletions

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),