balena-io-modules / network-manager

Rust NetworkManager bindings
Apache License 2.0
35 stars 29 forks source link

Better Pre-Shared-Key for WPA networks validation #111

Open majorz opened 6 years ago

majorz commented 6 years ago

Our PSK validation is incomplete. It needs to act according to the following rules:

If the key is 64-characters long, it must contain only hexadecimal characters and is interpreted as a hexadecimal WPA key. Otherwise, the key must be between 8 and 63 ASCII characters (as specified in the 802.11i standard) and is interpreted as a WPA passphrase.

In addition to this, the current validate_password function can be renamed to validate_psk and publicly exported to be used by other modules/applications (e.g. WiFi Connect).