Commit fdc219f
authored
The "rejects a JWK with the right x but wrong y" test flipped the last
base64url char of y from 'A'→'B' (or x→'A'). Because the final base64url
char of a 32-byte field carries only 4 high bits — the bottom 2 are
padding — 'A' (000000) and 'B' (000001) decode to the SAME bytes
whenever y ended in 'A' (≈1/16 of randomly generated keys), turning the
"corruption" into a no-op so the test occasionally accepted the JWK as
valid. (A second, far rarer path: the flip landed on -y mod p.)
Set y to 32 zero bytes instead. (x, 0) is on secp256k1 iff x³ ≡ -7
mod p, which has exactly 3 solutions in ~2²⁵⁶ — provably off-curve for
any practical random x. Verified across 30 consecutive runs.
1 parent 63690e5 commit fdc219f
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
214 | | - | |
215 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
| |||
0 commit comments