10

I was thinking of generating a WPA-PSK passphrase, and I see in the OpenBSD manpage for wpa-psk(8):

The passphrase must be a sequence of between 8 and 63
ASCII-encoded characters.

What exactly is the criteria for "ASCII-encoded" here? Just that they must be 8-bit chars with the high bit unset? Are non-printable characters allowed?

Come to think of it... Does my approach of randomly generating a passphrase make any sense? Would it be better to just generate 64 random bytes and use that as a key?

asveikau
  • 233

2 Answers2

14

What exactly is the criteria for "ASCII-encoded" here? Just that they must be 8-bit chars with the high bit unset? Are non-printable characters allowed?

Wikipedia's Wi-Fi Protected Access says the WPA-PSK passphrase is 8 to 63 printable ASCII characters, and includes this reference as a footnote:

Each character in the pass-phrase must have an encoding in the range of 32 to 126 (decimal), inclusive. (IEEE Std. 802.11i-2004, Annex H.4.1) The space character is included in this range.

Come to think of it... Does my approach of randomly generating a passphrase make any sense? Would it be better to just generate 64 random bytes and use that as a key?

I think I'll still just generate 256 bits using a secure RNG...

Does your wireless router and every device you want to connect to your wireless network let you manually enter the WPA-PSK key as 64 hex characters? If not, then you may have to use an ASCII passphrase to be able to enter it in all of your devices.

MMM
  • 3,257
Bavi_H
  • 6,710
1

From http://www.xs4all.nl/~rjoris/wpapsk.html - "WPA key calculation - From passphrase to hexadecimal key Details of the Calculation":

For WPA-PSK encryption, the binary key is derived from the passphrase according to the following formula:

The function PBKDF2 is a standardized method to derive a key from a passphrase. It is specified in RFC2898 with a clear explanation on how to compute it. The function needs an underlying pseudorandom function. In the case of WPA, the underlying function is HMAC-SHA1. SHA1 is a function that computes a 160-bit hash from an arbitrary amount of input data. It is clearly explained in RFC3174. HMAC is a standardized method to turn a cryptographic hash function into a keyed message authentication function. It is specified in RFC2104.

To summarize, the key derivation process involves iterating a HMAC-SHA1 function 4096 times, and then doing that again to produce more key bits. The amount of computation involved is equivalent to computing the SHA1 hash over 1 MByte of data. Perhaps that explains why the Javascript on this page is so slow.

As for your question: Does my approach of randomly generating a passphrase make any sense? Would it be better to just generate 64 random bytes and use that as a key?: Either one would be very strong, as long as you used all kinds of symbols, numbers, and random alphabet characters in your random bytes passphrase. The way I look at it: both of them (generated or random) would be impossible to guess/hack...

studiohack
  • 13,477