More setCredentials questions

A few questions about setting credentials. Yes, I know I asked about some of this back in April 2016.

  1. I know that if I do the following to an open network, it works. By “open” I mean no authentication is needed and no encryption is performed.


Must the network be visible to the Photon when the setCredentials instruction is issued? If the network is actually NOT an open network, is there some error return? What would get written into the Photon’s credentials?

  1. The firmware reference documentation shows examples of calling setCredentials. One arg, two args, three args, four args.

The second example is two args:

WiFi.setCredentials(“My_Router”, “mypasswordishuge”);

Why is the third arg, for AUTH, not needed? The comment in the documentation implies that the “two arg” use of setCredentials is used for WPA2 networks. Is that correct?

If the supplied password is wrong, what happens? Does the supplied password get checked against My_Router, assuming it’s active, to verify it’s correct? What gets written into the Photon’s credentials if the password fails?

Does the setCredentials instruction interrogate the access point to determine which encryption cypher to use?

And what is WLAN_CIPHER_AES_TKIP used in the four argument call? Use either?

  1. The third example in the documentation shows three args, where the third arg allows the caller to specify which AUTH to use. Why is this needed? Under what circumstances would the programmer need to use the three argument instruction call?

  2. It appears the setCredentials instruction is using information in the calling sequence plus information it gleans from the wifi net itself. I am not sure what credentials get stored, if any, if there’s a mismatch somehow. Nor do I know if there is any error condition returned.

One could issue the instruction and then read the credentials to see what happened (what actually got written) but that sounds too roundabout.

  1. How many times can the persistent memory which holds credential be rewritten? Is this the same memory as the “emulated” EEPROM which is available to the programmer? (As in, “EEPROM.update(0, 21);”) Is there any limit on number of writes which can be done to emulated EEPROM? I guess that suggests the question: Is there any limit to the number of flashes which can be done? I am sitting at probably a thousand flashes right now.

  2. Off the wall question: Captive portals exist at, for example, motels. They are open networks (no authentication and no encryption) but there is a blocking web site which pops up where you need to enter a “portal password”. Now you are in. The question: Since subsequent traffic is UN-encrypted, cannot a hacker grab all the traffic and determine the passwords to, say, your email system?