## 2 Background and Related Works
### Related Works
The authors of [21] present the interworking layer of distributed MQTT brokers (ILDM), which enables multiple MQTT brokers to cooperate with each other. The proposed system relies on MQTT brokers, which are placed at the edges, and ILDM nodes, which are located between the brokers and their clients. The ILDM node can connect with other ILDM nodes; thus, multiple brokers can communicate with each other via ILDM nodes. The system is prone to different kinds of attacks, such as impersonation, MITM, and replay attacks, since no security solutions are presented. The author of [22] proposed the edge-cloud pub/sub broker model, which allows multiple brokers to dynamically coordinate among each other for data delivery to achieve high-scalability and low-latency properties in a large-scale IoT system. The model depends on coordination servers to manage subscription and publication requests among the brokers. The proposed model did not involve any security solutions. Regarding studies that proposed security solutions, especially authentication for distributed MQTT architecture with multiple brokers, the authors in [23] presented a lightweight and secure authentication scheme for MQTT based on fog computing, which comprises multiple fog gateways as brokers. The scheme used the Elliptic Curve Diffie-Hellman Ephemeral (ECDHE) key exchange algorithm along with the pre-shared key (PSK). However, the paper did not present a broker bridging mechanism, which enables the broker to publish and subscribe the topic to/from other brokers, and the authentication scheme did not take into account brokers' communication. In addition, the results showed that the average transmission and processing times are extremely high, reaching 4.25 s and 2.5 s, respectively. Furthermore, there is a significant increase in the average packet size and the number of packets. The authors of [24] presented a scalable and secure MQTT communication framework for the Industrial IoT based on multi-stage brokers. The single trusted authentication and authorization server (AS) is responsible for clients' authentication and access token generation to define the right of clients to subscribe to or publish a topic. The cryptographic access token is signed through the asymmetric key RSA with a key size of 2048 bits, and the authentication is performed during the TLS handshake protocol. The limitations of this framework are that the central AS could not accommodate the rapid growth of IoT devices, which hinders the scalability and causes a single point of failure or bottleneck, and the high computation cost of RSA and TLS, resulting in heavyweight authentication, which is not suitable for resource-constrained IoT devices. Furthermore, mutual authentication is not provided between the clients and brokers. To the best of our knowledge, the lightweight mutual authentication scheme and scalable authentication architecture for fog-based MQTT architecture that comprise multiple brokers communicating with each other have not been addressed. Compared to the current works, our proposed architecture implements lightweight mutual authentication between client-broker communication and broker-broker communication using hash function and XOR operation. This reduces the storage overhead, computation costs, and communication overhead of resource-constrained IoT devices. In our proposed architecture, deploying an authentication manager in each broker and clustering the clients and brokers into groups that connect to a single specific broker allows the independency of the authentication management for each group of clients/brokers. This will reduce the possibility of security threats and facilitate security management. Our system enables brokers and their deployed authentication managers to scale-up and scale-out in case clients' requests exceed the processing capacity of the broker. This will avoid network congestion and bottlenecks.