def comserver_post_notification(self, payload):
     assert self.is_mobile_paired(), "unexpected mobile pairing error"
     url = 'https://digitalbitbox.com/smartverification/index.php'
     key_s = base64.b64decode(self.digitalbitbox_config['encryptionprivkey'])
     args = 'c=data&s=0&dt=0&uuid=%s&pl=%s' % (
         self.digitalbitbox_config['comserverchannelid'],
         EncodeAES(key_s, json.dumps(payload).encode('ascii')).decode('ascii'),
     )
     try:
         requests.post(url, args)
     except Exception as e:
         self.handler.show_error(str(e))
 def hid_send_encrypt(self, msg):
     reply = ""
     try:
         secret = Hash(self.password)
         msg = EncodeAES(secret, msg)
         reply = self.hid_send_plain(msg)
         if 'ciphertext' in reply:
             reply = DecodeAES(secret, ''.join(reply["ciphertext"]))
             reply = to_string(reply, 'utf8')
             reply = json.loads(reply)
         if 'error' in reply:
             self.password = None
     except Exception as e:
         print_error('Exception caught ' + str(e))
     return reply