Exemplo n.º 1
0
    def lineReceived(self, data):
        print "Client: got data %s" % data
        # Check for HELLO first as it defines our session key....
        if data[0:6] == "HELLO\t":
            self.session_key = utils.hex_decode(data.split("\t")[1])
            self.hmac_wrapper = utils.hmac_wrapper(self.session_key + self.config.get('auth', 'shared_secret'))
        message = self.verify_data(data)
        #print "Client: Got message %s\n" % message
        #print "Client: self.session_key=%s" % utils.hex_encode(self.session_key)
        if message == False:
            print "ERROR Hash mismatch"
            return

        self.parse_message(message)
Exemplo n.º 2
0
 def connectionMade(self):
     self.factory.bus.add_signal_receiver(self.dbus_signal_received, dbus_interface = "com.example.TestService")
     self.session_key = utils.create_session_key()
     self.hmac_wrapper = utils.hmac_wrapper(self.session_key + self.factory.config.get('auth', 'shared_secret'))
     self.send_signed("HELLO\t%s" % (utils.hex_encode(self.session_key)))
     self.keepalive_timer = reactor.callLater(self.keepalive_timeout.seconds, self.keepalive_callback)