This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Encrypted advertise

I want to use NRF51822 to advertise is door close/open. No need bidirectional data sending. Only one way from NRF sensor to mobile phone app. Actually I have only two different packets: door open, door close. I have to encrypt that packets. It's easy to use AES in ECB mode over RF channel. But again it will give only two different packets. It's easy to understand what means each packet. To make each message unique I have to use AES in CBC mode. But for using CBC mode RF channel must be stable, if I lost several packets I can't decrypt data. How to solve this problem?

Parents
  • No need for CBC mode. When you agree the AES key reset a counter (something long) to zero on each side. When you encrypt a packet, increment the counter and encrypt the packet + counter, decrypt on the other side. As long as the counter is larger than any you have seen, it's a new packet not a replay so accept it and then bump your own expected counter.

    If you change the key, reset the counter to zero. Doesn't matter if you lose packets, as long as the counter keeps increasing you can be sure you're not getting a replay attack.

Reply
  • No need for CBC mode. When you agree the AES key reset a counter (something long) to zero on each side. When you encrypt a packet, increment the counter and encrypt the packet + counter, decrypt on the other side. As long as the counter is larger than any you have seen, it's a new packet not a replay so accept it and then bump your own expected counter.

    If you change the key, reset the counter to zero. Doesn't matter if you lose packets, as long as the counter keeps increasing you can be sure you're not getting a replay attack.

Children
Related