1. Home
  2. Explore
  3. Computer Science
  4. IoT Encryption and Digital Signatures

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

IoT Encryption and Digital Signatures

Secure Connectivity in IoT: Encryption, Authentication, and Digital Signatures

Security goals and authentication types

Encryption and authentication mechanisms support several related but distinct security goals:

  • Confidentiality means preventing unauthorized parties from reading data. Both symmetric and asymmetric encryption can provide confidentiality.

  • Integrity means detecting whether data was altered or corrupted. Message authentication codes and digital signatures can help verify integrity.

  • Authentication means establishing who or what is communicating, or verifying the source of a particular message. Entity authentication, message authentication, certificates, and digital signatures address different parts of this goal.

  • Non-repudiation means providing evidence that a particular party originated a message, making it harder for that party to plausibly deny having sent it. Digital signatures can support non-repudiation.

Entity authentication

Entity authentication establishes that a device is communicating with the intended party—for example, that an IoT sensor has connected to the genuine server rather than an impostor conducting a man-in-the-middle attack.

It is typically performed at the beginning of a communication session. Once the device has verified the other party’s identity, entity authentication has answered the question: “Am I connected to the party I intended to reach?”

Message authentication

Message authentication checks individual messages exchanged during a session. Even after a device has authenticated a server, an attacker might try to insert or alter messages during the conversation. Message authentication helps the receiving party determine whether a message:

  • Came from the party it originally connected to.

  • Has remained unchanged in transit.

Message authentication therefore applies throughout a conversation, not just at the beginning. It can also detect accidental corruption caused by transmission errors.

Entity authentication verifies a communicating party at the start of a session; message authentication verifies the messages received during that session.


Symmetric encryption

Symmetric encryption uses the same shared secret key to encrypt and decrypt data. Both communicating parties must possess this key.

For example:

  1. The endpoint encrypts data with the shared key and sends it to the server.

  2. The server decrypts the data with the same key.

  3. The server can encrypt a response with that key, and the endpoint can decrypt it with the same key.

Because both parties use the same secret, the key must be shared securely before encrypted communication can begin. If an attacker obtains it, the attacker may be able to decrypt the protected traffic.

Common symmetric ciphers

  • AES is a widely used symmetric cipher and the most common choice in many applications.

  • DES and 3DES are older ciphers being phased out; they are not used in TLS 1.3.

  • ChaCha20 is a modern alternative to AES, commonly paired with Poly1305 for message authentication.

Why symmetric encryption is used for bulk data

Symmetric encryption is generally much more computationally efficient than asymmetric cryptography. It is therefore well suited to bulk encryption—protecting large amounts of data, such as the ongoing traffic in an internet connection.

A typical secure communication design uses asymmetric techniques to establish or authenticate a connection, then uses symmetric encryption to protect the larger volume of data exchanged.

Message authentication with symmetric encryption

Encryption alone does not necessarily prove that a message came from the expected sender or remained unchanged. Symmetric encryption is therefore commonly paired with message authentication, often through an authenticated-encryption cipher or a separate message authentication code.

Examples of cipher-and-authentication combinations include:

  • AES-GCM

  • ChaCha20-Poly1305

A message authentication code (MAC) is a value calculated from a message and a secret key. The receiver independently calculates and checks the expected value. A valid MAC provides evidence that the message was generated by someone who knows the shared key and that the message has not been altered.

Implementations can also include sequence numbers, nonces, or session-specific values to help reject replayed messages. A replay attack attempts to resend a previously valid message; freshness information helps the receiver recognize that the message is not new.

A MAC does not encrypt the message. It provides message integrity and authentication, while encryption provides confidentiality. Authenticated-encryption schemes combine encryption and authentication functions.


Asymmetric cryptography

Asymmetric cryptography uses a mathematically related pair of keys rather than one shared key:

  • A public key can be distributed openly.

  • A private key must be kept secret by its owner.

In a common encryption use, a sender encrypts data using the recipient’s public key, and only the recipient’s corresponding private key can decrypt it. This protects data sent in that direction.

To support encrypted communication in both directions using this approach, each party needs its own public–private key pair. The recipient’s public key protects data sent to that recipient; the recipient’s private key decrypts it.

Unlike a symmetric key, a public key is not secret and can be sent openly. The private key does not need to be transmitted, which avoids the particular problem of securely delivering a shared encryption key. However, public keys still need to be reliably associated with the identities they claim to represent; certificates and trust mechanisms help address this.

Limitations and common uses

Asymmetric cryptographic operations are generally much more computationally intensive than symmetric encryption. They are therefore not usually used to encrypt large volumes of data directly.

Their principal uses include:

  • Key exchange: establishing a shared symmetric key without sending that key openly.

  • Authentication: demonstrating possession of a private key associated with a public key.

  • Digital signatures: verifying the source and integrity of data.

  • Certificates and public-key infrastructure: associating public keys with identities.

RSA and elliptic-curve cryptography

Two important families of asymmetric cryptography are RSA and elliptic-curve cryptography.

  • RSA has historically been used for both key exchange and digital signatures. In TLS 1.3, RSA is no longer used for key exchange, though RSA-based signatures may still be used.

  • Elliptic-curve cryptography (ECC) supports authentication methods such as digital signatures. For key exchange, it is commonly paired with a Diffie–Hellman method. ECC can provide comparable security with smaller keys than RSA, and it can offer performance and scaling advantages as key sizes increase.

Names beginning with EC commonly indicate elliptic-curve techniques. For example, ECDH and ECDHE are elliptic-curve Diffie–Hellman key-exchange methods, while ECDSA is an elliptic-curve digital-signature algorithm.


Digital signatures and secure hashing

A digital signature helps demonstrate that data came from the holder of a particular private key and that the data has not been changed since it was signed. It is commonly used to protect software updates, certificates, and other data distributed over a network.

How a digital signature is created and verified

A signing process typically works as follows:

  1. The sender applies a cryptographic hash function to the data. A hash produces a compact, fixed-length value representing the input.

  2. The sender uses a private signing key and a signature algorithm to create a signature associated with that hash.

  3. The sender distributes both the original data and the signature.

  4. The receiver calculates a hash of the received data and verifies the signature using the corresponding public key.

  5. The receiver checks that the signature is valid for the calculated hash.

If verification succeeds, the receiver has evidence that the data matches what was signed and that the signature was created by someone possessing the corresponding private key. The signature does not encrypt the original data: anyone may be able to read the data unless separate encryption is used.

Hashing is useful because the signature operation works on a compact representation of the data rather than directly processing a large file as a signature. Hashing the entire file also means that changes to the file result in a different hash and cause signature verification to fail.

Example: authenticating an over-the-air update

For an over-the-air (OTA) software update:

  1. The update publisher hashes the update image.

  2. The publisher signs the hash using a private key reserved for code signing.

  3. The update image and signature are sent to the IoT device.

  4. The device uses the corresponding public key to verify the signature and calculates the hash of the image it received.

  5. If verification succeeds and the calculated hash matches the signed content, the device has evidence that the update was signed by the holder of the trusted private key and was not altered in transit.

The public key must be obtained and trusted securely. Otherwise, an attacker might substitute a different public key and attempt to make a fraudulent update appear valid.

A hash algorithm’s security matters to this process. SHA-256 or a stronger secure hash is generally preferred. MD5 and SHA-1, although once commonly used and sometimes supported by hardware accelerators, are no longer considered secure choices for modern security uses.


Key exchange and Diffie–Hellman

Symmetric encryption requires both parties to share the same secret key. Sending that key over an unsecured connection would allow an eavesdropper to capture it and potentially decrypt later traffic.

Diffie–Hellman (DH) key exchange addresses this problem by allowing two parties to derive a shared secret without transmitting the secret itself. Both sides exchange public information and independently perform calculations that result in the same shared value. That value can then be used to derive a symmetric session key.

Ephemeral Diffie–Hellman and forward secrecy

Diffie–Hellman Ephemeral (DHE) generates fresh key-exchange values for each communication session instead of relying on a long-term key-exchange value. The elliptic-curve version is called ECDHE.

This per-session approach supports forward secrecy. If a server’s long-term private key is compromised later, the attacker should not be able to use that key alone to recover the session keys from previously recorded ECDHE communications. The ephemeral session secrets are not permanently stored as the basis for those past sessions.

By contrast, if old communications relied on key material that could later be derived from a compromised long-term private key, recorded traffic could potentially be decrypted after the compromise.

Simplified ECDHE exchange

In a simplified ECDHE exchange:

  1. The server and endpoint exchange public key-exchange information, along with the required parameters.

  2. Each party combines the received public information with its own private, temporary value.

  3. Each independently derives the same shared secret.

  4. Both sides use the shared secret to derive session keys.

The secret itself is not sent across the network. The precise mathematics can be complex, but the important security idea is that both parties arrive at the same secret independently.

Key exchange also needs authentication. Without it, an attacker could intercept the exchange and establish separate keys with each side, creating a man-in-the-middle attack. Signatures or certificates can help each party verify that the key-exchange information came from the expected party.


Certificates and entity authentication

Asymmetric cryptography supports entity authentication by allowing a device to check that a server possesses the private key associated with a trusted public key.

A server can send a certificate containing its public key and identity information. The device then:

  1. Checks the certificate through a chain of trust, which links the certificate to a trusted authority or trust anchor.

  2. Verifies that the server possesses the private key corresponding to the public key in the certificate.

If these checks succeed, the device has evidence that it is communicating with the server associated with the trusted certificate, rather than simply with a party that sent an unverified public key.

Certificates therefore help bind a public key to an identity. They do not, by themselves, encrypt all communication; instead, they support trust and authentication, which can be combined with key exchange and symmetric encryption.


How the mechanisms work together

A secure IoT connection commonly combines the mechanisms rather than relying on only one:

  • Certificates and asymmetric authentication help establish that the endpoint is communicating with the intended server.

  • Authenticated key exchange, such as ECDHE combined with authentication, establishes shared session secrets while helping prevent interception and supporting forward secrecy.

  • Symmetric encryption efficiently protects the bulk data exchanged during the session.

  • Message authentication detects altered or forged messages and can help prevent replay.

  • Digital signatures authenticate items such as software updates by verifying their source and integrity.

These mechanisms address different threats: encryption protects confidentiality, authentication checks identities or message sources, integrity checks detect alteration, and forward secrecy limits the impact of later key compromise.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent