We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43d0b84 commit cdedf88Copy full SHA for cdedf88
src/spake2/spake2.py
@@ -25,6 +25,8 @@ class WrongGroupError(SPAKEError):
25
pass
26
class ReflectionThwarted(SPAKEError):
27
"""Someone tried to reflect our message back to us."""
28
+class KeyDegradationThwarted(SPAKEError):
29
+ """Someone tried to degrade our key material."""
30
31
SideA = b"A"
32
SideB = b"B"
@@ -113,6 +115,8 @@ def finish(self, inbound_side_and_message):
113
115
# ) * self.xy_scalar
114
116
pw_unblinding = self.my_unblinding().scalarmult(-self.pw_scalar)
117
K_elem = inbound_elem.add(pw_unblinding).scalarmult(self.xy_scalar)
118
+ if K_elem is g.Zero:
119
+ raise KeyDegradationThwarted
120
K_bytes = K_elem.to_bytes()
121
key = self._finalize(K_bytes)
122
return key
0 commit comments