• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microcontroller Tips

Microcontroller engineering resources, new microcontroller products and electronics engineering news

  • Products
    • 8-bit
    • 16-bit
    • 32-bit
    • 64-bit
  • Applications
    • 5G
    • Automotive
    • Connectivity
    • Consumer Electronics
    • EV Engineering
    • Industrial
    • IoT
    • Medical
    • Security
    • Telecommunications
    • Wearables
    • Wireless
  • Learn
    • eBooks / Tech Tips
    • EE Training Days
    • FAQs
    • Learning Center
    • Tech Toolboxes
    • Webinars/Digital Events
  • Resources
    • Design Guide Library
    • DesignFast
    • LEAP Awards
    • Podcasts
    • White Papers
  • Videos
    • EE Videos & Interviews
    • Teardown Videos
  • EE Forums
    • EDABoard.com
    • Electro-Tech-Online.com
  • Engineering Training Days
  • Advertise
  • Subscribe

Cybersecurity basics: Authentication and “key” management in LoRaWAN, Part 2

February 11, 2019 By John Koon

In part 1, we described the process of providing end-to-end security and some of the challenges in achieving network security. In this installment, we will go over how authentication work to achieve end-to-end network security between the end devices and the application servers.

Device authentication and key management

Each LoRaWAN device is given a unique 128-bit AES key (called AppKey) and a globally unique identifier (EUI-64-based DevEUI) for authentication purposes. For LoRaWAN, there are two ways for an end device to initiate a connection request to the application server: over-the-air activation (OTAA) and activation by personalization (ABP). Successful connection involves authentication using multiple keys after acceptance of the activation request. Only after the activation process is completed can encryption be applied. Otherwise, either the end devices or the application server will not have the key to decrypt a message.

It’s as if two countries engage in a battle, and the commander-in-chief delivers a secret message to the field operator. Not wanting the enemies to know the content, the message is encrypted. But the field operator must first have access to the method of deciphering (the key) the secret message. Otherwise, the message can never be deciphered. But if the method of deciphering (the key) is stolen by the enemy, the secret message is not a secret anymore.

What is a key? It is a series of long codes. When it used properly, both the application server and the end devices can decipher the encrypted messages both ways. Note that LoRaWAN specification 1.0x specifies one root key is issued while specification 1.1 specifies two root keys are issued. But the concept of key management remains the same.

How do OTAA and ABP work?

In OTAA, multiple keys are involved. Here is how it works.

Step 1: The end device sends an unencrypted activation request known as the Join Request to the application server. Usually, it will go through a gateway device and the network server before reaching the application server. It is similar to sending an email. The email will go through your router, then the modem and through the servers of your network provider such as ATT, Spectrum Cable or others. The join request is a long code that contains the device information, DevNonce (a unique random number) and a message integrity code (MIC). DevNonce, the unique 16-bit random number generated by the end device, can be used only once to ensure that the hacker cannot use it again to prepare for the next attack. The MIC is created using an algorithm to create a checksum. This algorithm uses the 128-bit CMAC-AES encryption with the AppKey (issued to the end device). Note that at this point, no encrypted data has been generated.

Step 2: The gateway device, upon receipt of the Join Request, will send back a Join Accept to the end device. This Join Accept message consists of an AppNonce, information generated by the application server, an ID and other relevant information. Note that that the Join Accept message is encrypted with the AppKey as described in Step 1 above.

Step 3: Upon receipt of the Join Accept, the end device can now derive a new key called a “session key.” This key is created with random Nonces (the DevNonce and the AppNonce) information received back from the Join Accept. Note that the “session key” is actually a set of keys called NwkSKey and AppSKey. Because the “session key” is good only for one session or one-time data transfer, hackers cannot copy and reuse. At this point, the encrypted data communication can be initiated.

Compared with OTAA, ABP is static and much simpler. Each device and server  (network and application) is issued a set of keys one time. So long as the data messages are encrypted and decrypted using the same keys, the data transfer will be successful.  The potential problem of ABP is that those keys are static. If they are stolen, copied or rekeyed, the network is compromised.

Summary

The open, standards-based, long-range wide area network commonly known as LoRaWAN provides low-power connections for many applications including smart homes, smart grids, infrastructure, smart farming, industrial IoT, smart cities and smart manufacturing. Each end device or edge device will need to go through a connection and authentication process to establish trust, so the application servers will know “You are who you say you are.” There are two different methods: OTAA and ABP. OTAA is more complicated but more secure. ABP is static and simpler, but the downside is that once the keys are stolen, the network is compromised. By comparison, OTAA uses “session keys” in which each communication session will make randomly generated keys, and hackers cannot reuse the stolen keys.

Questions remain, however. What is preventing hackers from stealing information or pretending to be the real device during the authentication process? How secure is the action and authentication process? In upcoming articles, we will explain the pitfalls of the network security and explore the hardware and partition approach to enhance network cybersecurity.

 

You may also like:


  • Cybersecurity basics: Server and end device relationship to LoRaWAN network,…
  • VC SpyGlass RTL Static Signoff software platform
    Cryptography software for ARM, ARC, x86 MCUs includes encryption, certificate…

  • Cryptographic microprocessor adds advanced security features to FPGAs
  • pi and thermostat
    How Mr. Robot hacked the IoT

Filed Under: Applications, Connectivity, FAQ, Featured, Security Tagged With: FAQ

Reader Interactions

Comments

  1. Vinay says

    July 12, 2020 at 4:44 am

    What is the key

Primary Sidebar

Featured Contributions

Engineering harmony: solving the multiprotocol puzzle in IoT device design

What’s slowing down Edge AI? It’s not compute, it’s data movement

Five challenges for developing next-generation ADAS and autonomous vehicles

Securing IoT devices against quantum computing risks

RISC-V implementation strategies for certification of safety-critical systems

More Featured Contributions

EE TECH TOOLBOX

“ee
Tech Toolbox: EMC/EMI
EE World has assembled a collection of articles that demonstrate how to measure emissions with simple antennas. We include a review of a handheld spectrum analyzer. We also look at EMC issues with IoT devices.

EE Learning Center

EE Learning Center

EE ENGINEERING TRAINING DAYS

engineering
“bills
“microcontroller
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

DesignFast

Design Fast Logo
Component Selection Made Simple.

Try it Today
design fast globle

Footer

Microcontroller Tips

EE World Online Network

  • 5G Technology World
  • EE World Online
  • Engineers Garage
  • Analog IC Tips
  • Battery Power Tips
  • Connector Tips
  • DesignFast
  • EDA Board Forums
  • Electro Tech Online Forums
  • EV Engineering
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips

Microcontroller Tips

  • Subscribe to our newsletter
  • Advertise with us
  • Contact us
  • About us

Copyright © 2025 · WTWH Media LLC and its licensors. All rights reserved.
The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media.

Privacy Policy