Commands / Logging in to the network

Logging in to the network

wpa_passphrase

Also psk, pmk, pbkdf2

Turns a Wi-Fi network's name and passphrase into the 256-bit key WPA2-Personal really uses.

WPA2-Personal never uses the passphrase itself. Both sides run it through PBKDF2, 4,096 rounds of HMAC-SHA1 salted with the SSID, into a 256-bit key: the PSK, which is the PMK the 4-way handshake starts from. wpa_passphrase SSID PASSPHRASE does the same sum and prints a network={ … } block for wpa_supplicant, with the passphrase in a comment and the key as psk= and 64 hex digits. The same name and passphrase make the same key on every machine, which is why a recorded handshake can be tested against guessed passphrases offline.

wpa_passphrase command usage

wpa_passphrase SSID [PASSPHRASE]

Options

SSID
the network's name: it salts the key, so another name makes another key
PASSPHRASE
8 to 63 characters; left out, it is read from standard input

wpa_passphrase examples

wpa_passphrase Office 'correct horse battery'
Prints a network block with the 256-bit key for that name and passphrase.

Pitfalls

  • The printed block keeps the passphrase as a #psk= comment: delete that line before saving the block in a config.
  • The psk= key joins the network as well as the passphrase does, so it is as secret as the passphrase.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab