Mercurial > libervia-backend
comparison libervia/backend/core/patches.py @ 4256:c14e904eee13
core: fix SCRAM challenge parsing.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 Jun 2024 22:35:47 +0200 |
parents | a1e7e82a8921 |
children |
comparison
equal
deleted
inserted
replaced
4255:32e49c389bfd | 4256:c14e904eee13 |
---|---|
86 """SCRAM-SHA authentication final step. Building proof of having the password. | 86 """SCRAM-SHA authentication final step. Building proof of having the password. |
87 | 87 |
88 @param challenge: Challenge string from the server. | 88 @param challenge: Challenge string from the server. |
89 @return: Client proof. | 89 @return: Client proof. |
90 """ | 90 """ |
91 challenge_parts = dict(item.split("=") for item in challenge.decode().split(",")) | 91 challenge_parts = dict( |
92 item.split("=", 1) for item in challenge.decode().split(",") | |
93 ) | |
92 self.server_nonce = challenge_parts["r"] | 94 self.server_nonce = challenge_parts["r"] |
93 salt = base64.b64decode(challenge_parts["s"]) | 95 salt = base64.b64decode(challenge_parts["s"]) |
94 iterations = int(challenge_parts["i"]) | 96 iterations = int(challenge_parts["i"]) |
95 self.salted_password = self._hi(self.password, salt, iterations) | 97 self.salted_password = self._hi(self.password, salt, iterations) |
96 | 98 |