Skip to content

Commit

Permalink
fix wampcra auth with salt
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahad-10 committed Jan 13, 2025
1 parent f722a22 commit 8badbd2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crossbar/router/auth/wampcra.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def _compute_challenge(self, user):
}
challenge: str = json.dumps(challenge_obj, ensure_ascii=False)
secret = user['secret'].encode('utf8')
signature = auth.compute_wcs(secret, challenge.encode('utf8')).decode('ascii')

# extra data to send to client in CHALLENGE
extra = {'challenge': challenge}
Expand All @@ -73,6 +72,9 @@ def _compute_challenge(self, user):
extra['salt'] = user['salt']
extra['iterations'] = user.get('iterations', 1000)
extra['keylen'] = user.get('keylen', 32)
secret = auth.derive_key(secret, extra['salt'], extra['iterations'], extra['keylen'])

signature = auth.compute_wcs(secret, challenge.encode('utf8')).decode('ascii')

return extra, signature

Expand Down

0 comments on commit 8badbd2

Please sign in to comment.