dwm_enc_key_set
Sets encryption key. The key is stored in a non-volatile memory. The key that consists of just zeros is considered invalid. If the key is set, the node will automatically enable encryption. Automatic enabling of the encryption is triggered via the UWB network when the node detects encrypted messages and can decrypt the messages with the key. The BLE option is disabled when encryption is enabled automatically. The encryption can be disabled by clearing the key ().
Normally, this call writes to internal flash when setting a new value. Hence, it should not be used frequently and can take hundreds of milliseconds in the worst case! Also, it requires a reset for the new configuration to take effect.
-
void dwm_enc_key_set(dwm_enc_key_t *key)
- Parameters
key – 16-byte value ? (the encryption key)
output – Status code
C code example
dwm_enc_key_t key;
key.byte[0] = 0x00;
key.byte[1] = 0x11;
key.byte[2] = 0x22;
/* ... */
key.byte[15] = 0xFF;
dwm_enc_key_set(&key)
SPI/UART example
TLV Request |
||
---|---|---|
Type |
Length |
Value |
0x3C |
0x10 |
0x00 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88 0x99 0xAA 0xBB 0xCC 0xDD 0xEE 0xFF |
Type 0x3C means command dwm_enc_key_set
TLV Response |
||
---|---|---|
Type |
Length |
Value (see error codes) |
0x40 |
0x01 |
0x00 |
Type 0x40 means err_code of the previous command