**7.3 Service layer or application layer**

The application layer is responsible for different IoT services, such as smart home, smart city, etc. This is also called the service layer in standard SDN-IoT architecture. Different protocols work on the application layer of the IoT network. Message Queuing Telemetry Transport (MQTT) is one of the protocols used in the application layer which enhances machine-to-machine communication between client and server. The challenge of the MQTT protocol in 5G is to work with constraint IoT devices. The security improvement of the MQTT protocol is called Secure MQTT (SMQTT). The new version improves the security perspective of MQTT. For this purpose, there are many lightweight security algorithms are used, such as AES and RSA. Arduino is an open-source IoT development tool that uses the RSA algorithm. Diffie-Hellman (DH) and Elliptic Curve Cryptography (ECC) can be an alternative solution to the RSA algorithm. ECC is the most efficient public-key encryption technique in terms of power consumption for resource constraints IoT devices in comparison with other encryption techniques, such as RSA, Diffie-Hellman, and Digital Signature Algorithm (DSA). In ECC, it uses less key size and provides higher security. It is also a low latency algorithm that can be implemented in hardware as well as software environment leads to use this in infrastructure layer as well as cloud security environment. This technique also supports the minimum requirements of 5G security in terms of key value which must be at least 256-bit. We present the comparison of different LWCA in terms of GE, block length, and key length in **Table 1**.


*Lightweight Cryptographic Techniques in 5G Software-Defined Internet of Things Networking DOI: http://dx.doi.org/10.5772/intechopen.102984*

#### **Table 1.**

*Comparison of different LWCA for different layers of SDN-IoT network in 5G.*

#### **Experimental Study:**

All the LWC algorithms presented in this chapter can implement in software/ hardware/both environments. We are here to present a code snippet of the TEA algorithm using c language with a few lines of code. Here we present the algorithm for implementation purposes. The algorithm uses 32 rounds, although 16 rounds are sufficient. The term "delta" indicates here golden ratio serves for encryption/ decryption purposes to get different values in each round.

Encryption:

1.Initialize:

a.int. round = 0;

b.unsigned long delta = 0x9e3779b9, a = 0, data[], key[], p, q;

2.p = data[0], q = data[1];

3.While (round <32)

a.a = a + delta;

b.p + = ((q < <4) + key[0])^(q + a)^((q> > 5) + key[1]);

c.q + = ((p < <4) + key[2])^(p + a)^((p> > 5) + key[3]);

d.round ++;

4.data[0] = p, data[1] = q;

Decryption:

1.Initialize:

a.int. round = 32;

b.unsigned long delta = 0x9e3779b9, data[], key[], p, q, a;


a.q + = ((p < <4) + key[2])^(p + a)^((p> > 5) + key[3]);

b.p + = ((q < <4) + key[0])^(q + a)^((q> > 5) + key[1]);

c. a = a - delta;

d.round --;

4.data[0] = p, data[1] = q;
