You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wireguard: T7246: verify base64 encorded 32byte boundary on keys
It's probably wisest to ignore differences between public keys and private keys
and set aside any structure they might have by virtue of being related to
elliptic curves, and instead just regard them as 32-byte strings encoded in
base64.
Not 31 bytes or 33 bytes, but exactly 32. This matters, because 32 does not
divide evenly by .75, so there's a padding character and the penultimate
character does not include the whole base64 alphabet. 43 base64 chars can
represent up to 258bits, which is more than 256bits. So, you can either
validate this with a base64 parser and checking that it returns exactly
32 bytes, or you can match against this simple regex:
^[A-Za-z0-9+/]{42}[A|E|I|M|Q|U|Y|c|g|k|o|s|w|4|8|0]=$
Source: https://lists.zx2c4.com/pipermail/wireguard/2020-December/006222.html
0 commit comments