我正在尝试使用通过pyaes的AES加密进行MQTT应用程序。在解码期间,我使用b'Message'而不是消息来获取输入。如何确保消息只是打印出来?修剪和过渡功能不起作用
import time
import paho.mqtt.client as mqtt
import os
import pyaes
import sys
# This is the Subscriber
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
client.subscribe("topic/test")
def on_message(client, userdata, msg):
#keys = os.urandom(16)
#iv = os.urandom(16)
keys = //Random Keys
iv = //Random IV Key
bart = pyaes.AESModeOfOperationOFB(keys,iv=iv)
decrypted = bart.decrypt(msg.payload)
#print(msg.payload,"\n")
print("Message is : ",decrypted,"\n")
client.disconnect()
broker = "192.168.1.104"
port = 1883
keepalive = 60
client = mqtt.Client()
client.connect(broker,port,keepalive)
client.on_connect = on_connect
client.on_message = on_message
client.loop_forever()
输出消息输出:b'这是消息'
我希望输出输出:这是消息