| In recent years,with the rapid progress of information technology and integrated circuit technology,the Internet of things has developed into a hot scientific research field.More and more kinds of devices are connected to the Internet,which has brought great convenience to people’s life and study.Human beings have stepped into an era of interconnection of all things.However,the development of the Internet of Things is also facing a lot of challenges,of which the two most important challenges are security and standardization.First,not all devices that transmit data are legitimate and in a reliable network environment.There are a lot of data collection and transmission processes between IoT terminals and applications,so they often face security problems such as data leakage,tampering,traffic attacks and illegal access.Due to the limited computing capacity and hardware resources of IoT devices,mature data protection methods such as authentication and encryption in traditional Internet cannot be directly applied.Secondly,the protocol standards of the Internet of Things are not unified,and the standards of the traditional Internet are not applicable to the Internet of Things.Due to the wide variety of IoT devices,different equipment manufacturers use different technical interfaces,network types and communication protocols,so it is difficult to build a unified IoT architecture system,resulting in high construction costs of IoT,which cannot form a complete industrial chain.To solve the above problems,this thesis designs and implements a secure and scalable Internet of Things middleware based on MQTT and CoAP.The middleware can mask the heterogeneity of the underlying network,provide a standard and unified access interface,support the functions of encryption transmission,authentication,access control and cluster message.In addition,it also meets the characteristics of protocol extension,topic flow limiting and file transfer,and has the advantages of high availability,high concurrency and scalability.The main contents of this thesis are as follows:(1)Design and implementation of message transmission module for the middleware.This thesis studies the message format and workflow of MQTT and CoAP,and designs two protocol access and data transmission schemes,which are subject publish-subscribe pattern based on MQTT and request-response pattern based on CoAP respectively.MQTT uses TCP long connection for data transmission,which is suitable for real-time message push in unreliable networks.CoAP runs on UDP,and the client and server communicate one to one through connectionless datagram.,compared with MQTT,the message is smaller and more suitable for low-power restricted devices.(2)Design and implementation of file transmission scheme for the middleware.This thesis studies the block transfer mechanism of CoAP,proposes a file transfer scheme based on CoAP block transfer,and implements a simple file server.This scheme can be used to update firmware and transfer files between the device and the server for limited devices working on unreliable networks.(3)Design and implementation of encryption,device authentication and authorization scheme for the middleware.This thesis analyzes and studies the authentication methods commonly used in the traditional Internet,provides three implementation methods of device authentication,which are MySQL authentication,HTTP authentication and Token authentication,and improves them to meet the requirements of the Internet of Things.(4)Design and implementation of cluster message scheme for the middleware.In order to enhance the availability and scalability of middleware,this thesis proposes a cluster message implementation scheme based on publish-subscribe pattern of Redis and observer pattern.All nodes in the cluster are registered in Redis as subscribers,and the connection and subscription request of the client will be sent to a node in the cluster in the way of load balancing.Cluster messages are forwarded to all subscriber nodes via Redis,and subscriber nodes distribute messages to all clients based on the topic of the message.Finally,for the designed middleware system of the Internet of Things,virtual machines are used to build a three-node experimental environment,and the function and performance of the middleware system are tested.The experimental results show that compared with other open source middleware,the Internet of things middleware designed and implemented in this thesis has high throughput,low latency and good scalability,and effectively solves some security problems in the Internet of Things. |