Invalid message from WireGuard about a wrong public key for peer
Making an experimentation with Wireguard Package on pfSense 2.6
After using Wireguard android apps to generate a peer private/public keys, I'm not able to save the public key in the GUI using the « Save Peer » button.
The public key (XtyQ7Qb3T9s9l5WtMRpf26+J/uNUElzOgBPZma4Hahs=) is not a valid WireGuard public key.
Can you please detail the steps you took which resulted in the key not being accepted?
I'm unable to reproduce this on 2.6 using Wireguard for Android v1.0.20220516 on Android 13. The public key provided by the app is accepted when I click Save Peer, as is the public key provided in the screenshot above. For reference, the app offered me this key:
PfSense also accepted the key with white spaces preceeding and trailing the key in the form field. The only way I could reproduce the error shown above was to remove a single character from the generated keys.
Updated by Yann Papouin 2 months ago
To transfert the key from the Wireguard Android device to my PC, I made a copy using the builtin touch-to-copy to clipboard and next I pasted it to a new draft on the Gmail android version.
Using the syncing function, I get back the draft from GMail on my PC using the web version.
I kept the draft e-mail so I was able to analyse its content using a vscode extension.
And indeed there is a space at the end of the string but this character is invisible (ZERO WIDTH SPACE 0x200b).
I don't know when and why this character was added.
Maybe the trimming function should take care of all these unicode space characters.
Or another way would be to only keep valid characters.