# A Trustworthy Communication Hub for Cyber-Physical Systems
## 5 Solutions of the CPS Communication Hub
### Communication Spaces and Presence Services  
The realization of communication spaces and presence services relies on the distributed hybrid peer-to-peer (P2P) architecture model enabled by XMPP technology. At the architecture level, it enables client to server communication, server-to-server communication called server federation, and client-to-client communication. The main supported services include, for example, support for presence management, secure messaging (TLS), overlaid communication over IP, near real-time messaging, authentication, contact list management, and service discovery. The key applied capabilities from the XMPP technology in the CPS hub are physical presence, access, contact lists, and server federation.  
Initially, the administrator of the CPS hub makes the communication spaces for the users/owners of the physical resources (devices/servers) by making them accounts with the CPS hub server. After this step, each of the owners has a communication space in which the physical resources owned by the user can be registered. The communication spaces and presence services of the CPS hub assume that there is an XMPP client embedded in the physical resources. Such a client connects the physical resource to the server who is hosting the virtual communication space of the owner. The procedure, clarifying how a client in a physical resource connects into the communication spaces server, is visualized in the Figure 13.  
First, the server address is discovered by a domain part as a server address or discovering server address with Service record (SRV) lookup from Domain Name Service (DNS). The XMPP client embedded in the physical resource must establish a XMPP session with the XMPP server that is hosting the virtual communication space of the owner. The minimum parameter set for the session establishment contains a valid XMPP account identified by XMPP ID (JID) and a password, which are used for the authentication between the resource (client) and CPS hub (server). JID consists of a username, server, and resource parts, that is, part of the notation 1 clarified in Section 4.2, _<owner>@<domain.server>/<physical resource>_. Every client connects to his or her home domain server specified by his or her JID.  
The connections are established over TCP and optionally encrypted by the transport layer security (TLS) layer (recommended). An administrator of a domain may specify that encryption is mandatory and it is up to administrator or designer to choose whether or not TLS certificates shall be checked. Most client libraries accept self-signed certificates in client-to-server connections. The authentication can be carried out relying on a simple authentication and security layer (SASL) [27; 28], relying on the use of TLS.  
Figure 12: Services of the CPS hub.  
XMPP supports per-hop channel encryption using transport layer security (TLS) through a STARTTLS upgrade mechanism [10]. Per-hop encryption using TLS can be used to protect only messages transmitted between the client and the server, or messages transmitted between servers, but not inside servers that do the routing. TLS has been used mainly in client-to-server communication, and server-to-server communications are usually not encrypted. Mechanisms such as OpenPGP, off-the-record (OTR), TLS, Secure/Multipurpose Internet Mail Extensions (S/MIME), SIGMA, XML encryption, and Cryptographic Message Syntax (CMS) with JOSE to enable end-to-end encryption between two clients exist, but none of them has been deployed widely [10].  
Just after an XMPP session is established, the XMPP client of physical resource should also send the information of its presence to the XMPP server. The presence information will be stored in the roster of the owner, and used by the other physical resources of the same owner. However, when another owner wants to use the presence information of the owner, it is required that the owners need to first have a mutual agreement (\"trust\" relationship), before the presence information of their physical resources can be shared.