How to add Enterprise SSID with username and password stored in keychain

Hi Experts,

I am connecting to SSID with API associateToEnterpriseNetwork:identity:username:password:error:

  • I am successfully able to connect
  • Problem is when I turn off/on my wifi, it can not connect to SSID back again without asking username and password

Wondering if there is any way to store this permanently into key store so user do not have to enter it again? Any hint here would be helpful.

Replies

Core WLAN has various keychain helper routines in <CoreWLAN/CoreWLANUtil.h>.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • As always fast. Thanks a lot Eskimo. Will try this out.

  • Hi eskimo, I tried this out very quick, but code is giving panic NSString * onexuser NSString * onexpass (Just for reference to check correct data type) NSData * nssid = network.anyObject.ssidData; (here network is CWNetwork Object, so I can get ssidData and also verified that Hex O/P is correct) NSLog(@"NSSData: %@", nssid); CWKeychainDomain d = 2; OSStatus tp = [CWKeychainSetWiFiEAPUsernameAndPassword:d ssid:nssid username:onexuser password:onexpass];

    Thanks.

Add a Comment

Hi eskimo,

I am able to successfully execute code below, also er is null but seems after switch off / on Wi-Fi from UI again it is asking for username and password.

        OSStatus er = CWKeychainSetWiFiEAPUsernameAndPassword(d, nssid, onexuser, onexpass);
        NSLog(@"Status: %@", er);```

Am I using wrong routine?
Would appreciate help here.