When a 64 bit hex password is entered, wpa_supplicant fails with the
error:

 "wpa_supplicant (pid) Line 0: Invalid passphrase length 64 (expected:
  8..63)"

The fix is to not quote 64 char long hexadecimal passwords.  Tested
dd-wrt on a 64 char hex password.




git-svn-id: https://zxing.googlecode.com/svn/trunk@1468 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
vikrama 2010-07-05 22:25:20 +00:00
parent 7a8081f238
commit b8f4061c39
2 changed files with 14 additions and 4 deletions

View file

@ -124,12 +124,22 @@ public class WifiActivity extends Activity {
// Adding a WPA or WPA2 network
private int changeNetworkWPA(NetworkSetting input) {
WifiConfiguration config = changeNetworkCommon(input);
config.preSharedKey = NetworkUtil.convertToQuotedString(input.getPassword());
final String pass = input.getPassword();
// Hex passwords that are 64 bits long are not to be quoted.
if (pass.matches("[0-9A-Fa-f]{64}")){
Log.d(TAG, "A 64 bit hex password entered.");
config.preSharedKey = pass;
} else {
Log.d(TAG, "A normal password entered: I am quoting it.");
config.preSharedKey = NetworkUtil.convertToQuotedString(pass);
}
config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
// For WPA
config.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
// For WPA2
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
config.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
return requestNetworkChange(config);
}