Kahina Khacef
email: kahina.khacef@lip6.fr

Guy Pujolle
email: guy.pujolle@lip6.fr

Secure Peer-to-Peer communication based on Blockchain

Nowadays, electronic messaging is the most used network application, and the authentication between users is a vital property. The most commonly employed approaches to ensure this property are PKI and S/MIME email encryption protocols, but indeed they are facing multiples security threats, such as the MITM attack and EFAIL attack. The blockchain is an innovative technology that overcomes these threats and allows to decentralize sensitive operations while preserving a high level of security. It eliminates the need for trusted intermediaries. The blockchain is accessible to all network nodes and keeps track of all transactions already made. The goal of our work is to propose a secure messaging solution based on the blockchain technology. In this paper, we explain why blockchain would make communications more secure, and we propose a model design for blockchain-based messaging maintaining the performance and security of data recorded on the blockchain, using a smart contract to verify the identities and their associated public keys, and validate the users certificate. The system is entirely decentralized and allows users to exchange messages securely.

Introduction

Public Key Infrastructure (PKI) is a significant component to resolve authentication in networks and provides guarantees to trust a certificate signed by a certification authority(CA). A new concept named web of trust for his Pretty Good Privacy (PGP) encryption program uses PKI to provide confidentiality with encryption, authentication via the signature and web of trust via identity validation from peers. The certificates authenticate the public keys and allow you to perform cryptographic operations, such as encryption and digital signing. As authentication and identity validation is centralized in the PKI, that creates single points of failure.

The blockchain technology was designed to make the transaction more reliable. Blockchain technology is a potential solution to achieve data integrity, relying on cryptography to provide tamper-resistance. Blockchain can be utilized in such cases to achieve the secure communication and integrity of data. The blockchain is decentralized, and no centralized authority can approve transactions. All network participants must reach a consensus to validate transactions in a secure way, and previous records cannot be changed. A very high cost must be spent if someone wants to alter previous records. External attackers would have to gain access to every computer in the network that hosts the blockchain database at the same time to manipulate it, which is as practically impossible [START_REF] Schuermann | Bitcoin and Beyond-A Technical Survey on Decentralized Digital Currencies[END_REF].

The cryptocurrency Bitcoin was created by an unknown person using the alias Satoshi Nakamoto in 2008. Bitcoin generates and broadcast transactions to the Blockchain. Once validated, the transactions are propagated through the network and added into a block. Once a block is full, the block is appended to the Blockchain by performing a mining process. Miners try to solve a hard cryptographic puzzle named Proof of Work (PoW), and the node that solves the puzzle first adds the new block to the Blockchain. Bitcoin is based on decentralized trust. The trust is achieved as an emergent property from the interactions of different participants in the bitcoin system [START_REF] Bano | SoK: Consensus in the Age of Blockchains[END_REF]. The data stored on the blockchain cannot be hacked, modified or deleted. The immutability of data in this blockchain is strongest when the chain is long [START_REF] Cachin | Blockchain Consensus Protocols in the Wild[END_REF].

Motivations

Blockchain has been of great interest to engineers and investors because of its immense commercial potential and its use in applications as diverse as a cryptocurrency.

Several layering schemes of new features on bitcoin are proposed. A proposal to create a decentralized domain name service over Bitcoin appeared as BitDNS, eventually evolved into Namecoin, the first altcoin [START_REF] Loibi | Namecoin,Seminar innovative Internettechnologien und mobilkommunikation SS2014[END_REF]. Bitcoin has the most substantial amount of computational power securing the blockchain data. However, it's hard to introduce new functionality to bitcoin because that requires consensus breaking changes. Transactions in bitcoin did not include a standard method for carrying a data payload, and the blockchain grows at an exponential rate [START_REF] Hung | Data Analysis of Digital Currency Network: Namecoin Case Study[END_REF] that extends pressures upward on storage space and importantly network bandwidth. Due to the security concerns, only a handful of functions are permitted in standard transactions [START_REF] Deepak K | Consensus Protocols for Blockchain-based Data Provenance:Challenges and Opportunities[END_REF].

Peer to peer(P2P) systems help overcome many problems that go beyond traditional client-server approaches, but these features also introduce new issues such as how to establish the trust relationship within P2P networks. [START_REF] Mudliar | A Comprehensive Integration of National Identity with Blockchain Technology[END_REF].

The Ethereum blockchain is a platform for decentralized applications called smart contracts. Because Ethereum addresses are unique identifiers whose ownership does not change, their activity can be tracked and analyzed [START_REF] Nandar | Review of Ethereum: Smart Home Case Study[END_REF]. A smart contract is an executable code that runs on top of the blockchain, allows running an agreement between two parties automatically, without one of the parties being able to obstruct its execution. [START_REF] Ward | Untangling Blockchain: A Data Processing View of Blockchain Systems[END_REF].

At the time of the digital economy, data is brought to transit more and more between companies, from a client to a supplier, moving from one cloud to another with the advent of virtualization and containers. Our work describes the potential for applying blockchain to assure the traceability of data, certificate individual and secure messaging based on the blockchain technology.

Contribution and Organisation of Paper

In this contribution, we are interested in the security of the blockchain for messaging, which can be an email, a website or some other form of message. We propose a protocol that performs encrypted messaging on the public blockchain. The goal of our contribution is to achieve the three functionalities achieved by PKI using the blockchain as the database to store public keys, digital signature, and peer information, allowing each entity of the network to validate information about every other node in the network.

The main contribution of this paper is: Section 2) a presentation of the benefits of blockchain in cybersecurity, Section 3) briefly description of the current state of the art for Blockchain based PKI, and in Section 4) we present our proposed solution with a smart contract to use the legitimate secure certificate.

Blockchain

A blockchain is essentially a fault-tolerant distributed database of records of a public ledger of all transactions that have been executed and shared among participating parties [START_REF] Tewari | Netcoin:A Traceable P2P Electronic Cash System[END_REF]. Each transaction in the public ledger is verified by a consensus of a majority of participants in the system. Blockchain provides a tool for increasing data integrity using a combination of cryptography and consensus [START_REF] Guy | Decentralized Privacy: Using Blockchain to Protect Personal Data[END_REF]. As such, there is no central server point of control. The in-formation is stored in blocks, Each block contains transactions, a timestamp and a link to the previous block, and is cryptographically protected. What makes it secure is:

• Public key infrastructure: It uses public/private key encryption and data hashing to store and exchange data safely. • Distributed ledgers: There is no central authority to hold and store the data, it removes the single point of failure • Peer to peer Network: The communication is based on the P2P network architecture and inherits the decentralized characteristics. • Cryptography: Blockchain uses a variety of cryptographic techniques, hash functions, Merkle trees, public and private key [START_REF] Conti | A Survey on Security and Privacy Issues of Bitcoin[END_REF]. It is difficult to alter the blockchain, to make a modification, it is necessary to succeed in a simultaneous attack on more than 51% of the participants. • Consensus Algorithm: The rules which the nodes in the network follow to verify the distributed ledger. Consensus algorithms are designed to achieve reliability in a system involving multiple unreliable nodes. A consensus of the nodes validates the transactions. Choice of consensus algorithm has significant implications for performance, scalability, latency and other Blockchain parameters. The consensus algorithms must be faulttolerant [START_REF] Deepak | Consensus Protocols for Blockchain based Data Provenance: Challenges and Opportunities[END_REF]. • Transparency: Each transaction is visible to anyone with access to the system. If an entry can not be verified, it is automatically rejected. The data is therefore wholly transparent. Each node of a blockchain has a unique address that identifies it. A user may choose to provide proof of identity to others.

How Public Blockchain Solves PKI Problems?

In blockchain, the shared data is the history of every transaction ever made. The ledger is stored in multiple copies on a network of computers, called nodes. Each time someone submits a transaction to the ledger, the nodes check to make sure the transaction is valid. The transaction is being created in the chained data structure of blockchain, a new timestamp will be recorded at the same time, and any modification of data created before will not be allowed anymore.

A block is a data structure which consists of a header and a list of transactions. Each transaction is generally formed as trx:= (M, Signature) where M:= (PKSender, receiver, data); PKSender denotes the public key of a sender (address of the sender is derived from the PKSender), and receiver is the address of a receiver, Signature:=Sign SKSender (H(M)) where SKSender is the private key of the sender and H() is a secure hash function. A subset of them competes to package valid transactions into blocks and add them to a chain.

The owners of these nodes are called miners and the miners who successfully add new blocks to the chain earn a reward. A cryptographic hash unique to each block and a consensus protocol makes it tamper proof [START_REF] Deepak | Consensus Protocols for Blockchain based Data Provenance: Challenges and Opportunities[END_REF]. There are different types of the blockchain, and there are several consensus mechanisms used in the blockchain, we present the two most used consensus proof of work (PoW) and proof of stake (PoS).

Types of blockchains

1. Public blockchain: A blockchain that anyone in the world can read, can send transactions to and expect to see them included if they are valid. This means anyone can become part of the network and participate in the consensus process making them permissionless. There is no way to censor transactions on the network nor change transactions retrospectively [START_REF] Kalodner | An empirical study of Namecoin and lessons for decentralized namespace design[END_REF]. The content of the blockchain can be trusted to be correct. Public blockchains are, however, very inefficient. The more computing power is required to support trust. So, an attacker would need to acquire 51% of the network's computing power to change an entry in the blockchain. (e.g., Bitcoin, Ethereum, ZCash). 2. Consortium blockchain: It is a blockchain where a pre-selected set of nodes control the consensus process. 3. Private blockchain: A blockchain where access permissions are more lightly controlled, where rights to modify or even read the blockchain state restricted to a few users, where only known nodes are allowed to participate in the network. Ideally, it is internal for an organization. The writes permissions are kept centralized to one organization. Private blockchain reduces counterparty risk by enabling the exchange of data without the intermediation of third parties. 4. Permissioned Blockchain: It is a blockchain where we can allow specific actions to be performed only by specific addresses. The participants in the network can restrict who can participate in the consensus mechanism and who can create a smart contract and give the authority for some participants to provide the validation of blocks of transactions. A control access layer into the blockchain nodes is used. However, raise their questions, Who has the authority to grant permission? A permission blockchain may make its owners feel more secure, giving the database rigorous security and privacy capabilities but can see as violating the idea of blockchain because only some participants have more control, which means they can make changes whether or not other network participants agree.

Proof of work

PoW is the consensus algorithm used in bitcoin. The protocol use of elliptic curve cryptography for transactions signatures, and the elliptic curve digital signature algorithm (EDCSA) [START_REF] Siva Sankar | Survey of Consensus Protocols on Blockchain Applications[END_REF] is used. The user needs to provide her public key and her signature to prove ownership. A hash takes a lot of computing time and energy to generate initially. It thus serves as a proof that the miner who added the bloc to the blockchain did the computational work to earn. The hashes also serve as the links in the blockchain, each block includes the previous blocks unique hash.

If an attacker wants to tamper with the blockchain, he needs to control more than 50 % of the hashing power to become the first one to generate the new bloc.

Proof of Stake

There are no particularly heavy calculations in a PoS. PoS does not require powerful and expensive hardware for maintenance of the blockchain and do not consume a lot of electricity. PoS require significantly smaller resources than PoW. The digital currency has the concept of coin age. Coin age of a coin is its value multiplied by the period after it was created [START_REF] Mingxia | A Review on Consensus Algorithm of Blockchain[END_REF]. The probability that an account will succeed in confirming the next block of transactions to add to the blockchain is proportional to the amount of money that is on that account. Hash( hash(Bprev), A, t) ¡= Sold(A) M/D, with Sold(A), is the balance of address A, and t is the timestamp. Unlike the PoW, the only variable that the user can change is the timestamp.

Related work

In this section, we present the works made use Blockchain for secure transactions between users. Since BitDNS [START_REF] Loibi | Namecoin,Seminar innovative Internettechnologien und mobilkommunikation SS2014[END_REF], numerous approaches are proposed. Namecoin it is the first system to build a decentralized naming system using blockchain, the first altcoin from bitcoin with its blockchain [START_REF] Kalodner | An empirical study of Namecoin and lessons for decentralized namespace design[END_REF]. Satoshi believed that BitDNS should use its independent blockchain and event offered the first proposal for merged mining as a way to secure blockchain. Namecoin was also the first solution to zooko's triangle producing a naming system that is simultaneously secure, decentralized, and human-meaningful. Namecoin suffers from 51 % attacks [START_REF] Dai | From bitcoin to cybersecurity: a comparative study of blockchain application and security issues/ICSAI[END_REF], because of its insufficient computing power.

Blockstack uses the existing internet transport layer (TCP or UDP) and underlying communication protocols and focuses on removing points of cen-tralization that exist at the application layer. The underlying blockchain of Bitcoin limits the performance of Blockstack. [START_REF] Ali | Blockstack:A global Naming and Storage System Secured by Blockchain[END_REF]. Certcoin [START_REF] Conner Fronknecht | CertCoin: A Namecoin Based Decentralized Authentication System[END_REF] removes central authorities and uses the blockchain Namecoin as a distributed ledger of domains and their associated public keys. Every certcoin user stores the entires blockchain, and this causes two problems, the latency for the controller and the security problems of merged mining used by Namecoin. Emercoin [START_REF] Khovayko | EMCSSL Decentralized identity management,passwordless logins, and client SSL certificates using Emercoin NVS[END_REF]: Blockchain-based PKI that doesn't remove central authorities but uses Blockchains to store hashes of issued and revoked certificates. Emercoin has the side benefit of optimizing network access by performing key and signature verification on local copies of the blockchain. However, all of these systems faced the same barrier. This consensus involves significant energy, delay, and computation overhead because of high resource demand for solving the PoW. The primary goal of our approach is to secure communications between entities of the network. The proposed model is to use the blockchain to validate the user's identity and to ensure trust between users for exchanging messages with a high level of security. Each user must communicate only with the user's identity validated by the smart contract, and consider every other interaction as malicious. Each user how want uses the system to communicate with others must register their identity and their public key an store it on blockchain. To achieve such a system, we can use Ethereum public blockchain that implements smart contracts. The Ethereum network has up to 200,000 developers currently working on the protocol and derived projects, ensuring that the protocol remains cutting edge, it has a level of security. The most frequently used notations in our scheme are mentioned in Table 1.

Once the code conditions are validated in smart contract, it can run as scheduled. This execution is carried out in practice by sending a specific transaction to the blockchain that causes the execution of the smart contract.

Smart Contract

The smart contract is the code that is stored and executed on a blockchain. Once a smart contract is deployed, users cannot modify it since the contract was sented and validated. A user can send a transaction to the contact's address, and the transaction will be executed. Each interaction with the smart contract is recorded as a "transaction" on the blockchain. These transactions are grouped in a Merkle tree and stored in a block on the blockchain.

Blockchain Registration

1. The user Alice generate a pair key using ECDSA algorithm, a public keyK userA pub and private keyK userA pri , then derives the identity ID A , as the hash of the public key as shown in Fig. 2. Alice keeps the private key safely and requests to register its identity with the corresponding public key into the blockchain after to be verified and validate by the network. ), t, T ), is then stored on the blockchain, with the following pieces of information: (Id Alice, Public key of Alice, the validity of the public key and timestamp). 5. This is the registration process for all network entities.

Smart contract-based verification

When user Bob wants to send a message to Alice, Bob only presents ID B previously recorded on the blockchain and ID A of Alice with a time-stamp T to the blockchain. Each message must include the time. ECDH is a variant of the Diffie-Hellman algorithm for elliptic curves. Once the shared key is generated, it is used to encrypt messages using a symmetric key algorithm [START_REF] Corbellini | [END_REF].

Evaluation

Advantages

Our approach removes central authorities (CA) and uses the blockchain public as a distributed ledger of identity and their associated public keys. We use Blockchain to store public keys, digital signature, and peer information. Once published, the smart contract code works precisely as programmed. This is one of the main advantages of the platform, the code always interacts as promised it cannot be falsified, and it never has a downtime. The system is trust, transparent and traceable.

1. Confidentiality: Once the communication channel between users is secured, peer to peer encryption between endpoints can be set and only authorized users to have access to the messages exchanged. 2. Message integrity and Authentication: The blockchain checks the validity of the signature, before being stored. Another person can not change/modify the signed agreement or alter exchanged message during the network transit. Each user has a certificate stored on the blockchain. The smart contract checks the certificate and proves the identity of users. All exchanged messages are signed with private keys associated with the public key on certificates using the ECDSA algorithm. 3. Reliability: It is impossible to shut down all computers participating in the blockchain simultaneously. As a result, this database is always online, and its operation never stops.

Limitations:

In blockchain, the smart contract is executed sequentially that affect the performance of blockchain negatively. With the growing number of smart contract, the blockchain will not be able to scale. In practice, it is impossible to modify an existing contract in the blockchain after it has been registered in it. The design phase of these contracts will, therefore, require special attention to avoid any future disappointment.

Implementation

The smart contract plays a vital role in executing and performing the agreement among various users in the system. For implementing the proposed system, a smart contract can be created by developing the codes that run on the blockchain to execute the agreement signed by the nodes to validate the certificates of individuals. Smart contract promise low transaction fees compared to traditional systems that require a trusted third party to execute an agreement. The contract's state is stored on the blockchain, and it is updated each time the contract is invoked. Before sending/receiving the message, the smart contract first checks the identity and its associated public key, previously stored in the blockchain. Then, it checks the validity of the timestamp. Finally, the smart contract verifies the signature.

A smart contract can be developed with Solidity.

Conclusion

Our contribution benefits from an entirely decentralized architecture offering inherent fault tolerance, redundancy, and transparency. We have firstly proposed an approach that secure communication, it benefits of security properties of blockchain public. It shows how to use to the immutability of the blockchain to provide a solution to high problematics in the field of centralized PKI. We plan to implement our proposal to base our results empirically and demonstrate its viability. Our next proposal is to set up an architecture with smart contracts to validate, store and revoke the certificate on a public blockchain. The certificate of the individual will contain, his address and public key, the address of smart contract that issued it, and stored it in Off-chain.

Fig. 1

 1 Fig. 1 System architecture

Fig. 2

 2 Fig. 2 ID generation

1 .

 1 Bob sents a transaction: T B = [ID B ,ID A ,T, S userB pri (ID B , ID A , T )]. The Smart contract receives the request from the user Bob: 2. The smart contract checks if the presented ID B and ID A exist on the blockchain. The Smart contract reads and parses the two Alice and Bob recordings. a. It performs a Lookup of (K pub , ID), If existed the output return true. b. Once the validity of the public keys verified, the Smart contract checks the validity of the timestamp and the signature of the transaction. c. Finally, The smart contract validates the request and return true.

3 .

 3 Bob sends a transaction T 1 B = [ID B ,ID A ,T, E userA pub (ID B , ID A , T, K userB pub )] to Alice's address. 4. Next, Alice checks the transaction with his private key and then sends to Bob's address T 2 A = [ID A ,ID B ,T+1, E userB pub (ID A , ID B , T + 1, K userA pub )]]. 5. After receipt of the transaction by Bob, the same verification will be performed, and mutual authentication is established between the two entities. 4.1.4 Send/Receive message Once mutual authentication is established, Alice uses Bobs public key and Alices private key to generate a shared secret. The shared secret can be generating using the Elliptic-curve-Diffie-Hellman (ECDH) to encrypt Message.

Table 1 Notations

 1

	4 Contribution
	4.1 The proposed model
	notation	definition
	Alice, Bob	Entities
	K userA pub	public key of Alice
	K userB pub	public key of Bob
	K userA pri	private key of Alice
	K userB pri	private key of Bob
	ID A	Id of Alice
	ID B	Id of Bob
	S userA pri	signature with private key of Alice
	E userA pub	encryption with public key of Alice
	t	validity of the Public Key
	T	time stamps


Runbo Su

Arbia Riahi Sfar

Enrico Natalizio

Pascal Moyal

Ye-Qiong Song

PDTM: Phase-based dynamic trust management for Internet of things

Keywords: Attacks, Trust management (TM), Internet of Things (IoT) security, Trust-related attack (TRA), Hybrid architecture

Preventing the negative effects caused by misbehaving of nodes or malicious intrusions is an essential task in trust management (TM) for the Internet of Things (IoT). Although many TM models have been proposed and developed, the majority of these approaches assigns nodes trust scores by means of a single static evaluation mechanism without taking into consideration the heterogeneity of IoT nodes and network segments, and the challenges posed by context awareness and scalability. Thus, an applicable TM model is needed to overcome these limitations. In this paper, a phasebased dynamic TM (PDTM) model is proposed. This model enables nodes' trust scores to be calculated diversely and dynamically in terms of phases. Finally, numerical results show the effectiveness and the accuracy of the proposed model, and resilience against various types of trust-related attacks (TRA).

I. INTRODUCTION

W ITH an enormous amount of effort from both academia and industry, multifarious IoT applications have been developed: smart house, health care, traffic management, etc. A growing number of smart objects and devices (thereafter referred as "nodes") gained access to the Internet, and nowadays outnumbers the world population. Despite technological advancements in IoT, several security challenges are constraining IoT systems [START_REF] Sfar | A game theoretic approach for privacy preserving model in iot-based transportation[END_REF]: a huge number of connected nodes in a complex environment, over wired or wireless links augments not only the system's cost, but also the risk of considerable damages. In this regard, trust management (TM) plays a crucial role, as it enables the trustworthiness of nodes to be evaluated to maintain the reliability of an IoT system.

The concept of TM was originally introduced in 1996 [START_REF] Blaze | Decentralized trust management[END_REF]. Till now, TM has been witnessed as one of the significant solutions for IoT security. The usage of TM for some particular network environments, such as Peer-to-Peer (P2P) systems, wireless sensor networks (WSN), and mobile ad-hoc networks (MANET), has been extensively investigated [START_REF] Chahal | Trust management in social internet of things: A taxonomy, open issues, and challenges[END_REF].

However, there are still a number of unsolved issues [START_REF] Altaf | Trust models of internet of smart things: A survey, open issues, and future directions[END_REF]: First, heterogeneity, as a TM model should meet the requirements of IoT devices heterogeneity. Second, context awareness, as a TM model, effective for one application, may not be applied in multi-application/service cases. Third, scalability, as the increasing size of the IoT networks needs a feasible mechanism for processing a large amount of data. Fourth, dynamicity, which concerns the static assignment of trust scores and dynamic behavior of nodes over time discordance. Fifth, resilience, where the TM models should provide robustness, accuracy, effectiveness against TRA, but only few works consider the resilience of TM towards TRA.

In this context, we propose a phase-based dynamic TM (PDTM) model. Our contribution is fourfold. First, we introduce a clustering based architecture addressing the scalability issue. Second, we propose a trust computation scheme established on 4 phases model fitting various contexts. Third, for dynamic trust evaluation, we define the quality of service provider and rater, and their quantity factors depending on the number of services provided and rated. Finally, we design a node classification mechanism distinguishing effectively and accurately normal/bad nodes, weak/bad service provider/rater, and TRA attackers.

The rest of this paper is organized as follows. Section II reviews related contributions on TM models. Section III discusses the framework of the proposed model. Section IV explains the PDTM model in detail and demonstrates the usefulness of each phase. The simulation results and performance analysis are presented in Section V. Section VI draws the conclusion and an outline of the future work.

II. RELATED WORKS

To solve the trust issues in an IoT context, diverse methods and technologies have been proposed and developed. A centralized context-aware TM model for a multi-service environment was proposed by Saied et al., [START_REF] Saied | Trust management system design for the internet of things: A context-aware and multi-service approach[END_REF]. In this work, feedback is collected by a trusted manager, which updates the trust value by taking into account the quality of recommendation (QR). Chen et al. [START_REF] Chen | Trmiot: A trust management model based on fuzzy reputation for internet of things[END_REF] designed a fuzzy TM model, named TRM-IoT, which enhances cooperation between sensor devices. The reputation of a node is computed by evaluating the end-to-end packet forwarding ratio, packet delivery ratio, and energy consumed. To conduct trustworthiness management in social IoT, Nitti et al. [START_REF] Nitti | Trustworthiness management in the social internet of things[END_REF] proposed both subjective and objective methods counting social attributes, such as centrality, the community of interest , and friendship. Jayasinghe et al. [START_REF] Jayasinghe | Data centric trust evaluation and prediction framework for iot[END_REF] designed a datacentric framework to alleviate the effect of data inconsistency. Alshehri et al. [START_REF] Alshehri | Clustering-driven intelligent trust management methodology for the internet of things (citm-iot)[END_REF] proposed a clustering-based model, called CITM-IoT, using Master Node (MN) to manage cluster nodes, and Super Node (SN) to address the cluster allocation of MN. Du et al. [START_REF] Du | Trust authorization monitoring model in iot[END_REF] presented a trust authorization monitoring model aiming at reducing the overall energy consumption and adjusting the malicious node detection thresholds dynamically, by employing the BP algorithm. Fang et al. [START_REF] Fang | Fetms: Fast and efficient trust management scheme for information-centric networking in internet of things[END_REF] designed a fast and efficient TM scheme (FETMS) based on a distributed architecture to compute trust values using Bayes distribution. Although these works show significant results in Trust Management by applying diverse methods and technologies, they are still facing several limitations: only the authors in [START_REF] Nitti | Trustworthiness management in the social internet of things[END_REF] and [START_REF] Du | Trust authorization monitoring model in iot[END_REF] consider the heterogeneity of IoT system, and only the works of [START_REF] Saied | Trust management system design for the internet of things: A context-aware and multi-service approach[END_REF] and [START_REF] Jayasinghe | Data centric trust evaluation and prediction framework for iot[END_REF] address the context-aware issue. Furthermore, [START_REF] Jayasinghe | Data centric trust evaluation and prediction framework for iot[END_REF] lacks dynamicity and scalability, [START_REF] Saied | Trust management system design for the internet of things: A context-aware and multi-service approach[END_REF] and [START_REF] Chen | Trmiot: A trust management model based on fuzzy reputation for internet of things[END_REF] also lack scalability. For the resilience, TM models of [START_REF] Saied | Trust management system design for the internet of things: A context-aware and multi-service approach[END_REF], [START_REF] Alshehri | Clustering-driven intelligent trust management methodology for the internet of things (citm-iot)[END_REF], [START_REF] Fang | Fetms: Fast and efficient trust management scheme for information-centric networking in internet of things[END_REF] treated the On-Off Attack (OOA), [START_REF] Saied | Trust management system design for the internet of things: A context-aware and multi-service approach[END_REF], [START_REF] Nitti | Trustworthiness management in the social internet of things[END_REF] and [START_REF] Du | Trust authorization monitoring model in iot[END_REF] proposed solutions handling both Bad Mouthing Attack (BMA) and Ballot Stuffing Attack (BSA). The comparison between these TM models and our work is given in Table I. A. PDTM architecture TM architectures can be mainly classified into two categories: centralized and distributed. Both have their own strengths and shortcomings; and some researches suggest combining both architectures [START_REF] Truong | A survey on trust computation in the internet of things[END_REF], because neither full distributed nor full centralized models are fully optimal when facing the aforementioned issues. For this reason, clustering techniques in IoT have been introduced with the aim of balancing the resource loading, increasing the network scalability, and achieving efficient communications [START_REF] Xu | A Survey of Clustering Techniques in WSNs and Consideration of the Challenges of Applying Such to 5G IoT Scenarios[END_REF].

[5] - x x - x - x x - [6] - - x - - - - - - [7] x - x x - - x x - [8] - x - - - - - - - [9] - - x x x - - - - [10] x - x x - - x x - [11] - - x x x - - - -

B. PDTM phases

Since nodes are able to perform dynamically over time, the trust scores should be determined distinctively depending on a concrete context. For instance, the prediction of newcomers' trustworthiness based on roughly assigning a fixed value will create unfairness. Similarly, estimating if nodes are qualified to assist in multi-service cases should be integrated into the TM model. To handle the cold-start and initialization issues, access and node's function. In the service evaluation phase, nodes act as service providers and raters (QSP ,QSR) and their overall trust score (T S) will be dynamically assessed by updating quantity and quality factors. Finally, the node classification phase categorizes the well-and badly-performing nodes, and malicious attackers through the use of a node classification scheme.

C. Attack model

In the simulation, we are concerned with the following types of TRA:

• Newcomer attack (NCA): attacker re-entries the system with a new identity to refresh its trust score. • Inconsistent Behavior Attacks (IBA) can be of two distinct types:

-On-off Attack (OOA): attacker switches its behavior between good and bad to maintain its trust score above a certain threshold. -Conflicting behavior Attack (CBA): attacker performs differently with different nodes.

• Unfair Rating Attacks (URA) also consist of two distinct kinds:

-Bad mouthing attack (BMA): attacker sends false feedback to decrease trust score of good service provider. -Ballot stuffing attack (BSA): attacker gives high recommendation for malicious nodes to increase their reputation.

IV. TRUST COMPUTATION

In this section, we detail the trust computation procedure of the proposed TM model. We start by presenting local TM in each phase. We then explain the inter-manager TM.

A. Local TM 1) Access control: Recording the node by its asserted attributes is more advantageous in terms of security [START_REF] Lam | Identity in the internet-of-things (iot): New challenges and opportunities[END_REF]. In our model, the attributes include 3 factors: the function factor (F fct i ), the social factor (F sco i ), and the context factor (F ctx i ). The set of attributes of node i is denoted as:

A i = F fct i | F sco i | F ctx i . ( 1
)
There exists a large number of attributes that can be exploited in access control, such as nodes' role (sensor/actuator/hybrid), events' timestamp, user information and preference, durability, etc. In our model, we consider service types (S), capabilities (C) for function factor, software specification (ssp) for social factor, and node's location (loc) for context factor. For any node i, we can compare the attributes and cluster community interests by means of the conformity (CF ) of 3 factors, given respectively by ( 2), ( 4) and ( 5).

-Conformity of function factor (CF fct i )

CF fct i = 1 |CN | k∈CN |T i ∩ T k | |T i ∪ T k | , (2)
where |A| denotes the cardinality of the set A, CN is connected nodes in the current cluster and T i is defined as a set of pairs of service types and capabilities of node i:

T i = {< s, c >: s ∈ S i , c ∈ C i }. (3)
-Conformity of social factor (CF sco i )

CF sco i = 1 |CN | k∈CN v ssp ik , (4)
where v ssp ik is a binary value describing if the interaction between i and k is adoptable in terms of their software specification.

-Conformity of context factor (CF ctx i )

CF ctx i = 1 2 • (1 - loc im • loc ic loc im × loc ic ), (5)
where loc im and loc ic correspond to the relative locations, i.e., loc ab = loc b -loc a . In such manner, the ideal position is between the manager and the centroid, comer node situated too far from the manager or the centroid will not gain a great value. The centroid location loc c is computed as follows:

loc c = 1 |CN | k∈CN loc k . (6)
With these conformity values, the default score of node i (DS i ) can be computed as follows:

DS i = ω fct • CF fct i + ω sco • CF sco i + ω ctx • CF ctx i , (7)
where the ω variables are weights, such that ω sco + ω fct + ω ctx = 1. Fig. 3(a) demonstrates that the comer node is authorized to entry if DS i > 0.5, the manager stores the description (Des i ) by adding trust fields after A i :

Des i = A i | T S i | QSP i | QSR i . (8)
Then, the node's description Des i is included in the list of connected nodes (CN), the manager updates it according to the results issued during the service evaluation phase. Nodes can voluntarily leave or change cluster, e.g., an energy-constrained device, which left for being recharged and then reconnects to the network, should be treated as a returner rather than as a newcomer. For this purpose, the node must predict its return by informing the destination manager of the target location and time: Pre i = M re i |loc re i |t re i . The manager generates a message combining the prediction and the description: msg i = Pre i |Des i , then gives to the node a value, computed by one-way hash function h i =Hash(msg i ) and transmits msg i to the destination manager.

As shown in Fig. 3(c), the destination manager verifies the satisfaction of certain conditions: i) the received value==Hash(msg i ); ii) the information in prediction matches its entry; iii) the DS obtained by (7) > 0.5. Nodes from the same cluster may continue to be assessed by the previous T S, QSP and QSR; and nodes from other clusters can only benefit previous QSR.

The access control phase in PDTM model enables to assign nodes a default score with conformity values by evaluating their attributes, and to distinguish the newcomer, returner of the same cluster, and cluster changer by usage of the triple checking rule illustrated in Fig. 3(c). Hence, newcomer attacker can not whitewash their reputation and nodes' attributes can be utilized in following trust evaluation as well.

2) Pre-selection: Upon receiving a request mission from nodes with QSR>0.5, the manager computes first the preselection conformity value by comparing the function factors of the candidate node and target mission:

P CF i = |T i ∩ T tgt | |T i ∪ T tgt | . (9)
The manager can establish a list by ranking pre-selection scores (P S i ):

P S i = P CF i • QSP i . (10)
The value of DS i computed by [START_REF] Nitti | Trustworthiness management in the social internet of things[END_REF] during the access control is used to replace QSP i when a node is a newcomer. Finally, the manager selects the best-ranked nodes for service provision according to the requirement.

3) Service evaluation: Service raters j (including consumer nodes and assisting nodes in cooperative case) should send a feedback f ji for service provider i to the manager with a note in the range of [0, 1[ (0 means no service conducted from service provider). a) Trust score (T S): We set

T S i = α i • QSR i + (1 -α i ) • QSP i , (11)
for

α i = |SR i | |SR i | + |SP i | , (12)
where QSR i and QSP i are given by ( 13) and (15).

b) Quality of service rater (QSR):

QSR i = ϕ • CQSR i + (1 -ϕ) • LQSR i , (13)
CQSR i = 1 - 1 |R ij | j∈Rij |f ij -fj | 1/p , (14)
where ϕ belongs to [0.5, 1[, fj is the average of j's notes, CQSR and LQSR are current and last values of QSR. LQSR=DS for newcomers. The calculation of QSR is based on the comparison between the opinion of the rater node and the average value of other raters, which enables to distinguish the dishonest service raters. Therefore, an unfair rating from a dishonest rater either ruins a well-behaved node's reputation or boosts a misbehaved node's reputation, will be detected. c) Quality of service provider (QSP ):

QSP i = ε • CQSP i + (1 -ε) • LQSP i , ( 15
)
where ε is set in the range [0.5, 1[, to weight the current value (CQSP ) and the last value (LQSP ). LQSP =DS for newcomers.

CQSP i = 1 |R ji | j∈Rji θ ji • λ ji • QSR j • f ji . ( 16
)
The unstable behaviors will be punished in terms of the time by θ ji and service consumers by λ ji . In other words, the unique opportunity that the node gains reputation is to keep providing satisfying services in a steady fashion.

θ ji = sinc(1 -f ji ) • sinc(∆f ji ) ∆t ( 17
)
λ ji = 1 -|f ji -fi | 1/p , ( 18
)
where ∆t and ∆f ji are time gap and difference of last feedback (lf ji ) and present feedback (cf ji ), ∆t = t cfji -t lfji and ∆f ji = |cf ji -lf ji |, we set both 0 for the first time evaluation of newcomers. fi is the average of i's notes rated by others and p is a punishment factor. The sinc function is defined as follows:

sinc(x) = 1, for x = 0 sin(πx) πx , for x = 0 (19)
There are two reasons why we choose the sinc function in (17). First, the range of the function is [0,1] for x in [0,1] because the function continues at 0. Second, the changes in the slope of the sinc function can be utilized to penalize the large ∆f ji and poor f ji .

4) Node classification:

By classifying the values of T S, QSP and QSR under good (>0.5) and bad (≤0.5), the node classification scheme illustrated in Table III enables the manager to categorize nodes into 6 groups: (a) Normal node (NN), (b) weak service rater (WSR), (c) weak service provider (WSP), (d) bad service rater (BSR)/ unfair rating attacker (URA), (e) bad service provider (BSP) / inconsistent behavior attacker (IBA), and (f) bad node (BN)/ mixed type attacker (MTA). From a global perspective, weak service provider or rater cases can be considered as intermediate inspection phases, because of T S > 0.5. Nodes belonging to the bad service provider or rater, or TRA attacker, namely group (d), (e), and (f), must be removed immediately in order to isolate the malicious nodes and prevent their negative effects.

TABLE III: Node classification scheme

B. Inter-manager TM

As heads of clusters, managers are somehow relatively small in quantity, and there is no service provision or rating unlike the local environment. Therefore, the inter-manager TM is aimed at reducing the cost of inter-manager communications and simplifying the cluster change for nodes, by identifying 'distant' clusters with the help of centrality (G mp ), cooperativeness (CO mp ), and inter-manager conformity (M CF mp ), given by ( 21), ( 22), and (23), respectively. The inter-manager trust (MT) of p evaluated by m can be computed as follows,

M T mp = η G • G mp + η CO • CO mp + η fct • M CF mp , (20)
where η variables are weights, such that η G + η CO + η fct = 1.

-Centrality

G mp = |N m ∩ N p | |N m ∪ N p | , (21)
where for all i, N i denotes the set of neighbors of i.

-Cooperativeness

CO mp = AC pm + 1 AC pm + DC pm + 2 , ( 22
)
where AC pm and DC pm correspond to accepted and rejected nodes from p to m, respectively. The changing cluster scheme is discussed in Section IV-A1.

-Inter-manager conformity

M CF mp = |T C m ∩ T C p | |T C m ∪ T C p | , (23)
where T C i represents the union of all the tags of the connected nodes controlled by the manager i in the current cluster, i.e.

T C i = k∈CNi T k (24)
where the definition of the T k 's is unchanged as in Section IV-A1.

V. SIMULATION

This section analyses and verifies the performance of the PDTM model through simulations. First, we present the choice of simulation parameter values with their explanation. Then, we conduct the performance analysis of local TM per phase and of inter-manager TM.

A. Simulation Setup

As shown in Table IV, we set ω fct 0.6 because the function factor is more relevant than other factors. For η CO , we consider the cluster change, i.e., the cooperativeness value is more significant to demonstrate the inter-manager trustworthiness. Respecting the constraints of η G + η CO + η fct = 1 and ω sco + ω fct + ω ctx = 1, we assign other parameters 0.2. ε and ϕ are given 0.5 for the reason that the last and the current evaluations are equally important. Finally, we set p 2. B. Performance analysis per phase 1) Access control phase: Section IV-A1 presents the access control phase, which enables the default score assignment and triple checking mechanism for comer nodes. Fig. 4 shows different scenarios for comers: (a) describes a node that exits and re-enters the system several times without checking mechanism, which means every entry must trigger the request 2) Pre-selection phase: The pre-selection phase is aimed at accurately selecting the qualified service provider in order to avoid services from incapable or malicious nodes. Fig. 5 (a) demonstrates a capture of pre-selection conformity P CF and quality of service provider QSP values. The pre-selection scores P S illustrated in Fig. 5 (b) are used to rank the service provider to reject unqualified nodes with the help of two aforementioned values. The nodes with poor QSP or P CF will obtain low values for their P S, which is given by [START_REF] Du | Trust authorization monitoring model in iot[END_REF]. Due to the fact that the manager selects the bestranked candidates with high P S, nodes with low rank have little opportunity to provide service. 3) Service provision & node classification phases: Following the node classification scheme presented in Section IV-A4, all nodes can be categorized into six categories, as illustrated in Fig. 6.

C. Resilience 1) NCA:

The countermeasure for NCA is presented in Section IV-A1, the simulation results in Fig. 4 confirm its effectiveness.

2) OOA: Fig. 7 shows the OOA attacker behaves alternatively to keep its QSP above the threshold of 0.5. With the help of θ, the manager can detect the OOA attacker by measuring the stability of behaviors in terms of the time and punishing the services without good feedback. As discussed in Section IV-A3c, service provider nodes can only gain reputation by keeping stably providing good services. 3) CBA: In Fig. 8, QSP of CBA attacker decreases progressively with the help of λ, which reduces the QSP value of nodes that behave differently with different nodes. In the simulation, we consider the CBA attacker behaves badly with 10% client nodes during its service provision. 4) BMA/BSA: Both BMA and BSA belong to the URA, which leads a good service provider to be snubbed and a bad service provider to be promoted. To handle with them, comparing individual feedback with average level can determine the honesty of service raters. Figs. 9 and 10 demonstrate the changes in trust values in presence of BMA/BSA. The QSR evaluation enables to effectively detect unfair rating attacks (URA). As shown in Fig. 9, the attacked node's QSP recovers its trustworthiness since the attacker node has been isolated because of its trust score T S < 0.5. Analogously, malicious nodes' QSP drops after the isolation of the attacker node.

D. Inter-Manager TM

In Fig. 11 (a), the M CF shows managers (both evaluator and evaluated) have similar service types and capabilities. In the opposite way, managers in (b) are somehow not close in terms of conformity. This also causes cluster changes to be widely accepted in (a), but a few of them refused in (b). The M T value stays at a relatively high level above 0.5 in (a) and it is basically pasted into 0.5 in (b). Although managers do not provide service or rate service, they are capable of inclining other managers. For the evaluated managers with low M T , the evaluator manager can reduce the interaction frequency to economize on resources and energy.

VI. CONCLUSION

In this paper, we have presented a phase-based dynamic TM model named PDTM to address important issues in IoT systems. We have verified that the PDTM model is effective and accurate for dealing with initialization issue, service provider pre-selection, nodes classification, and importantly the countermeasures for several types of TRA, namely OOA, CBA, BMA, BSA, and NCA. As future works, we plan to move from simulation to implementation within real-world IoT devices that can act as both service provider and rater.

Fig. 1 :

 1 Fig. 1: Architecture of PDTM model

Fig. 2 :

 2 Fig. 2: Four phases of PDTM model

Fig. 3 :

 3 Fig. 3: Checking mechanism and prediction process in access control phase

  of a new DS, to prevent it benefiting from previous trust values; (b) gives the example of detection of a returner from the same cluster, thus, this type of node can keep previous trust values. Different from (b), in the case (c), the node can only use its QSR in case of cluster changes. Finally, both (d) and (e) show denied entries, because of giving the false message and new DS <0.5, respectively.

Fig. 4 :

 4 Fig. 4: Changes in trust values in five scenarios of access control.

Fig. 5 :

 5 Fig. 5: An example of pre-selection score (P S) computation based on candidate nodes' pre-selection conformity (P CF ) and quality of service provider (QSP )

Fig. 6 :

 6 Fig. 6: Trust evaluations of six categories: (a) normal node (NN), (b) weak service rater (WSR), (c) weak service provider (WSP), (d) bad service rater (BSR)/ unfair rating attacker (URA), (e) bad service provider (BSP)/ inconsistent behavior attacker (IBA), and (f) bad node (BN)/ mixed type attacker (MTA). In order to visualize the changes in trust values in this figure even if some of the trust values are lower than 0.5, TM model continues their trust evaluation.

Fig. 7 :

 7 Fig. 7: Changes in quality of service provider (QSP ) with θ and without θ in presence of on-off attack (OOA).

Fig. 8 :

 8 Fig. 8: Changes in quality of service provider (QSP ) with λ and without λ in presence of conflicting behavior attack (CBA).

Fig. 9 :

 9 Fig. 9: Changes in trust values of both attacked and attacker nodes with quality of service rater (QSR) evaluation and without this evaluation in presence of bad mouthing attack (BMA).

Fig. 10 :

 10 Fig. 10: Changes in trust values of both attacked and attacker nodes with quality of service rater (QSR) evaluation and without this evaluation in presence of ballot stuffing attack (BSA).

Fig. 11 :

 11 Fig. 11: Changes in values of cooperativeness (CO), centrality (G) , inter-manager conformity (M CF ), and inter-manager trust score (M T ) of convenient and distant cases.

TABLE I :

 I Summary of related TM models

	Ref.	H CA D S	OOA	CBA	R BMA	BSA	NCA

TABLE II :

 II Symbol description

	Symbol	Meaning
	DS	Default score
	P S	Pre-selection score
	T S	Trust score
	(a) QSP	Quality of service provider
	(b) QSR	Quality of service rater
	f ji	Feedback from j to rate service of i
	CN	Connected nodes in current cluster
	R ji	Nodes that rated i's service
	R ij	Nodes rated by i
	A	Attributes
	F	Factors of attributes
	fct	Function
	sco	Social
	ctx	Context
	CF	Conformity
	T	Tag
	S	Service type
	C	Capability
	ssp	Software specification
	loc	Location
	Des	Description of node
	P re	Prediction of node's return
	msg	Message combining P re and Des
	P CF	Pre-selection conformity
	M CF	Inter-manager conformity
	G	Centrality
	CO	Cooperativeness
	N	Neighbors
	M T	Inter-manager trust score
	α, β	Quantity factors of (a) and (b)
	SR

i Set of services provided by i SR i Set of services rated by i ω, η, ε, ϕ Weight factors θ, λ Behavior stability factors p Punishment factor can participate in cooperative services. Therefore, the PDTM architecture allows heterogeneous nodes with various properties to create links with each other in a multi-application environment. As a local central entity, managers are in charge of local TM and nodes access control. Moreover, intermanager communication and trust evaluation are conducted in a distributed manner.

TABLE IV :

 IV Simulation parameters

	Parameter	Value	Parameter Value
	ω sco , ω ctx η G , η fct	0.2	ω fct η CO	0.6
	ε, ϕ	0.5	p	2

  Table V illustrates various average feedback values of attacker node.

TABLE V :

 V Feedback values for the attacker after the attack launched

	Description	Value
	Avg feedback from the attacked nodes	0.422
	Avg feedback	0.767
	Avg feedback without counting the attacked nodes	0.805

(d) BSR / URA (e) BSP / IBA (f) BN / MTA