Hi,
we are experiencing some issues regarding sending the secret key over serial to the device during Factory Setup mode. More specifically, the device doesn't receive the secret key correctly and therefore the token decoding process always fails.
For example, when trying to send these numbers to the device (which is the example included in the code):
#1234;123456789;a29ab82edc5fbbc41ec9530f6dac86b1
the device understand the following:
SN:1234 SC:123456789 SK:22AA88EECCFFBB44EE9933FFDDCC6611
I believe the issue is to be found in the updateSecretKey() function and more specifically in how the received chars are converted to the sum variable through the strtol() function.
Something like this instead works great:
int updateSecretKey(unsigned char secretKey[16])
{
int i;
for (i = 0; i < 16; i++){
char temp[3];
char char1 = getByteSent();
char char2 = getByteSent();
sprintf(temp, "%c%c", char1, char2);
int sum = strtoul(temp, NULL, 16);
secretKey[i] = (unsigned char)sum;
delay(100);
}
return 0;
}
Hi,
we are experiencing some issues regarding sending the secret key over serial to the device during Factory Setup mode. More specifically, the device doesn't receive the secret key correctly and therefore the token decoding process always fails.
For example, when trying to send these numbers to the device (which is the example included in the code):
#1234;123456789;a29ab82edc5fbbc41ec9530f6dac86b1the device understand the following:
SN:1234 SC:123456789 SK:22AA88EECCFFBB44EE9933FFDDCC6611I believe the issue is to be found in the updateSecretKey() function and more specifically in how the received chars are converted to the sum variable through the strtol() function.
Something like this instead works great: