dS2824
dS2824
User Manual v4.09
AES binary command set
The AES Binary commands are the same as the Binary commands described above. The only
difference is that they are AES encrypted and always 16 bytes in length. The first bytes are the
same as described in the Binary command set. The last 4 bytes is the Nonce (a random num-
ber) and the bytes in the middle are undefined. The module will decrypt the command, gener-
ate the response and encrypt it before returning it to you.
Your program that controls the module will need to encrypt the commands and then decrypt
the response.
We use AES256 CBC encryption, hence the requirement for a 256 bit (or 32 byte) key. To com-
plete the security we use a random IV generated by a cryptographically secure random number
generator (ISAAC).
To control the module you will need to send the commands with AES encryption. To help you
with this we have examples in C#, Java and Python. The C# and Java applications are com-
plete and may be used or modified as you wish.
To prevent re-play (or Playback) attacks the command packet includes a Nonce. This takes the
form of a 32-bit (4 byte) random number in positions 12, 13, 14 & 15 of the 16 byte data
packet. For example when you send a Get Status command (0x30) you will get a 16 byte block
returned. The first 8 bytes (0-7) will be as defined for the binary commands. Bytes 8-11 are
unused. Bytes 12-15 contain the Nounce.
Commands with generate and send you a Nounce are:
0x30 – Get Status
0x31 – Set Relay
0x32 – Set Output
0x37 – Update all relays, On or Off
0x38 – Set only relays with corresponding bit set to On
0x39 – Clear only relays with corresponding bit set to Off
Commands which require a Nounce to be sent by you are:
0x31 – Set Relay
0x32 – Set Output
0x37 – Update all relays, On or Off
0x38 – Set only relays with corresponding bit set to On
0x39 – Clear only relays with corresponding bit set to Off
A Nounce is only ever used once, you must always used the most recently issued Nounce.
Copyright
© 2016-2021,
Devantech Ltd.
All rights reserved.
49