CC3000.connectToAP() and MAXLENGTHKEY

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
technobly
 
Posts: 118
Joined: Mon Oct 31, 2011 11:06 am

CC3000.connectToAP() and MAXLENGTHKEY

Post by technobly »

Reposting here for the general benefit of those that don't follow the Github repo:
https://github.com/adafruit/Adafruit_CC ... y/issues/4

I'm using the various examples like the WebClient and InternetTime on various networks and the one thing that keeps tripping me up is when the network password is longer than 16 bytes/chars. I have several secure networks that have long passwords that cannot be changed without serious implications.. i.e., hundreds of devices/computers need new passwords entered. Super headache. Some I don't even have the power to change.

The error I get is "Key length must be < 16" when using the cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY); function.

That said I found this place in the code where the MAXLENGTHKEY is defined and it says the following:
#define MAXLENGTHKEY (16) /* Hard coded to 16 in the API! :( */

Link here:
https://github.com/adafruit/Adafruit_CC ... 00.cpp#L67

So I decided to see how sad that sad face really was CHANGE the max from 16 to 32, but to my surprise it worked! My 24-byte WPA network password was a success and my connection and WebClient HTTP GET request were up and running.

So I'd submit a pull request to change this, but there seems to be something to it with that frownie face and all... thoughts?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: CC3000.connectToAP() and MAXLENGTHKEY

Post by adafruit_support_rick »

I've passed this along to the Powers That Be.

User avatar
humbytheory
 
Posts: 4
Joined: Sun Apr 03, 2011 8:36 am

Re: CC3000.connectToAP() and MAXLENGTHKEY

Post by humbytheory »

Folks, I too had the same problem but my key is 64 bits long... so making the following two changes to, Adafruit_CC3000.cpp, allowed me to connect to my router with my long key:

Change these two lines:
LINE: 90

Code: Select all

   #define MAXLENGTHKEY 			(32)  /* Cleared for 32 bytes by TI engineering 29/08/13 */
LINE: 953

Code: Select all

  int8_t  _key[MAXLENGTHKEY];
To the following:
LINE: 90

Code: Select all

   #define MAXLENGTHKEY 			(64)
LINE: 953

Code: Select all

   int16_t  _key[MAXLENGTHKEY];
Maybe you can update the library with this too. I hope it helps anyone else having trouble getting their CC3000 to connect with long keys! :D

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”