Cordova-Network-Manager icon indicating copy to clipboard operation
Cordova-Network-Manager copied to clipboard

IOS app breaks when WIFI password is shorter than 8 characters

Open arsenal942 opened this issue 6 years ago • 6 comments

Prerequisites

Check all boxes if you have done the following:

  • [x] Checked that your issue isn't already filed: https://github.com/tripflex/wifiwizard2/issues
  • [x] Make sure you fill out the Issue Type below

Issue type

Select all that apply

  • [x] Bug
  • [x] Enhancement
  • [ ] Task
  • [ ] Question
  • [ ] Other

Description

First of all: Great plugin! Very handy and useful!

The IOS call to connect() breaks the IOS app whenever the user inserts a WIFI password shorter than 8 characters.

It's well know that the WPA/WPA2 password length should be at least 8 character long and the app developer can easily prohibit the user for attempting such a connection.

But it would be nice to have a fail callback so the app won't break in case the developer forgets to verify the password length.

Steps to Reproduce

On an IOS device try to connect on an WIFI network with a password shorter than 8 characters.

Expected behavior: [What you expect to happen] Connect to a WIFI network.

Actual behavior: [What actually happens] 2018-04-23 17:18:31.209909-0300 EasyKey[3954:1944346] [] -[NEHotspotConfiguration valid:726 NEHotspotConfiguration invalid WPA/WPA2 passphrase length. (lldb)

Reproduces how often: [What percentage of the time does it reproduce?]

Everytime.

Versions

Test were made on IONIC built app running on an iPhone (IOS 11).

arsenal942 avatar Jul 19 '18 22:07 arsenal942

We are trying to connect with open network and passed empty string in the password as API does not have option to specify type of network (WPA/WEP/Open). It works in Android but fails in ios with same error [NEHotspotConfiguration valid:726 NEHotspotConfiguration invalid WPA/WPA2 passphrase length.

I tried to change following code

NEHotspotConfiguration *configuration = [[NEHotspotConfiguration alloc] initWithSSID:ssidString passphrase:passwordString isWEP:(BOOL)false]; to NEHotspotConfiguration *configuration = [[NEHotspotConfiguration alloc] initWithSSID:ssidString ]; in cordovaNetworkManager.m hoping that it will fix the issue as other parameters are not required for open network. But its not taking effect. Probably its not rebuild properly. How to rebuild plugin so that code changes cordovaNetworkManager.m are reflected in the app?

gailu avatar Jul 25 '18 11:07 gailu

WPA standards specifies that you have to have a password length of >= 8. I was in the middle of implementing a fix for this and will finish it today. I was a bit naive in how I did in in 2.5.3 so I will address it by end of day.

For the latest stable release, install @2.5.0

arsenal942 avatar Jul 25 '18 21:07 arsenal942

I understand that WPA standard specifies to have password length of >= 8 but here the problem is connecting with Open network not the WPA network. Apple has two different APIs to connect WPA and Open Network.

Actually plugin should check the length of password and if length is zero then it should call open network API otherwise WPA API. However problem is that calling Open Network API i.e. - (instancetype)initWithSSID:(NSString *)SSID; does not solve the problem and apple still checks the password length so I suspect a bug in apple API implementation of Open Network unless I am missing something obvious.

gailu avatar Jul 26 '18 07:07 gailu

Can anybody confirm if it is bug in ios API ((instancetype)initWithSSID:(NSString *)SSID) for open network?

gailu avatar Jul 27 '18 07:07 gailu

@gailu try the latest release of WifiWizard2 I added support for open networks (just can't test myself without an ios device): https://github.com/tripflex/WifiWizard2

tripflex avatar Aug 29 '18 14:08 tripflex

Sorry guys I've been away for a bit. I'll be looking to add this shortly.

arsenal942 avatar Sep 27 '18 01:09 arsenal942