## 4 Implementation Results  
There are four elements in MQTT message transmission, which are the publisher, subscriber, broker, and topic. To simulate resource-constrained devices, we used ESP8266 (ESP-01 and ESP-12F) to act as a publisher and subscriber, respectively, as shown in Figure 4, and raspberry pi 3 to act as the broker, which can also be the authority too. The entire system architecture is shown in Figure 5. ESP-12F and ESP-01 are two wireless IoT devices, and both are equipped with MQTT protocol, a chaos system, and PF-CP-ABE. All the messages are transmitted in an MQTT format, and are passed through the network to everyone. ESP-01 is the data owner (publisher), and it possesses a chaos master system. It needs to transmit all the parameters of chaos synchronization and attributes them to ESP-12F, which possesses a chaos slave system. ESP-01 with a temperature sensor will keep publishing ciphertext of the temperature, and ESP-12F will subscribe, decrypt, and show it on the displayer. There are some simulation situations where, if the temperature is too high, the alarm led will be lit up, and the switch on ESP-12F will act as a remote controller. All the values and states of devices will be published, and will be analyzed by an open source utility MQTT-SPY, monitoring software on a computer, and the MQTT tool, an IOS application on a cell phone.  
The encryption and decryption of the CS-ABE flow chart are shown in Figures 6 and 7, respectively, where the state variable of the master system also encrypted like \(M\), \(x_{s}=x_{1m}+sg\), and \(u_{m}\) is one of the parameters of the synchronization controller. At first, before chaos synchronization, both ESP-01 and ESP-12F establish the same elliptic curve and chaos system. The data owner, ESP-01, sets an access structure and generates \(s\) from its master system, and then publishes all parameters of attributes and synchronization. On the other side, ESP-12F subscribes it and sends its identity to the authority to request a valid result. After the identity is validated and the result is received, ESP-12F can calculate all the values to get the plain text of the temperature, and the synchronization controller still works. After both master and slave systems are synchronized, ESP-01 will stop publishing the parameters of attributes and only publish those of chaos synchronization, as shown in Figure 8. When ESP-12F receives them, it can generate \(s\) from its slave system to dec  
Figure 4: ESP-01 and ESP-12F devices.  
Figure 5: System architecture.  
From the analysis of MQTT-SPY, we recorded 80 data for the original temperature and the secret number \(s\) in the master and slave system, respectively. Then, we used the plot tool in Matlab to produce a graph, shown in Figure 8. The upper line is the temperature sensed on ESP-01, and the lower two  
Figure 8: MQTT-SPY analysis.  
Figure 6: Non-synchronization Chaos Synchronization Attribution-Based Encryption Scheme (CS-ABE) flow chart.  
Figure 7: Synchronization CS-ABE flow chart.  
lines are the secret number \(s\) of both the master and slave system used to check that they are the same. From this, we can find out that the secret number is different at the beginning, because chaos systems are not synchronized, and the secret number is solved by the PF-CP-ABE algorithm. After synchronization, the two randomly secret numbers become consistent, which means that the CS-ABE we proposed does work.