I want to store the HEX value into a uint8_t
array. Below is the code that I am trying to use and pass it to set the resource value:
const static uint8_t PSK_KEY[] = "31383031";
security->set_resource_value(M2MSecurity::Secretkey, PSK_KEY, sizeof(PSK_KEY) - 1);
Or do I need to set the PSK_KEY
in ASCII?
It depends on what you mean.
"Store hex" (why do you write it in caps?) is a bit unclear.
If the value of the PSK is the four bytes 0x31, 0x38, 0x30, 0x31 then you need to write it differently to get the proper result:
of course those four are ASCII, so you can express the same data as text: