I'm working on a network where nodes communicate using AES-CCM encryption, within a context of tight bandwidth limitations, making every bit count. The setup uses a nonce that combines a 16-bit node address, a timestamp incremented every 100 seconds (with only the offset transmitted), and a 10-bit counter unique to each node and timestamp. The size of the authentication code is 64 bits.
However I also need to encrypt the 16-bit node address which is used as a fixed part for the nonce.
My approach involves a two-step encryption process: first, encrypting the message with AES-CCM, and then encrypting the node address (and potentially the counter). During decryption, the node address is decrypted first and partly used as the nonce for the AES-CCM step. Separate keys are used for both steps and all inputs to the second step are authenticated. I've considered two methods for this.
First idea was to use AES-ECB. The node address and the counter essentially provide a network wide unique counter to encrypt. Also, since the node address is only 2 bytes and the counter part is not filling the AES block size of 16 bytes I intend to double encrypt some parts of the initial AES-CCM ciphertext. Otherwise I would have to pad the ECB input which is not desirable.
Another idea was to use AES-CTR for encrypting the address, utilizing the MAC from AES-CCM step, the timestamp, and the 10-bit counter as the nonce. The 64-bit randomness of the MAC, however, introduces a risk of nonce collision. Calculating the security level for the address encryption with this method is something I'm uncertain about.
These are two different approaches on how to achieve the 16-bit address encryption.
- Is ECB mode secure when encrypting already encrypted data?
- Is ECB mode secure when plaintext is guaranteed to be different for every encryption?
- How to evaluate the security of the CTR mode approach I described?