2 Replies Latest reply on Jul 13, 2017 3:22 AM by cmeng

    Smack OMEMO UndecidedOmemoIdentityException#getUntrustedDevices returns only undecidedOmemoIdentity

    cmeng

      Smack Omemo handling of the "UNSTRUSTED" omemoDevices are transparent to the application when sending OMEMO encrypted messages. In muc or single user chat, omemoManager just encrypted and send the the message without the embedding the untrusted </key rid> for decryption. No UndecidedOmemoIdentityException is being thrown. The method getUntrustedDevices() returns only devices that are undecided but not the untrusted.

       

      In a single user chat, when there is only one untrusted device, user may not aware that the omemo messages although are being sent but to unreachable destination.

      aTalk currently implements a local check for unTrusted device to alert user of this case in single user chat and muc. Just uploaded aTalk released version 0.8.3.

       

      /**
      * Check to see if all muc recipients are verified or trusted
      *
      * @param multiUserChat
      * MultiUserChat
      * @return return <tt>true</tt> if all muc recipients are verified or trusted. Otherwise
      * <tt>false</tt>
      */
      private boolean isAllTrusted(MultiUserChat multiUserChat)
      {
         boolean allTrusted = true;
         OmemoFingerprint fingerPrint;
         BareJid recipient;

         for (EntityFullJid e : multiUserChat.getOccupants()) {
         recipient = multiUserChat.getOccupant(e).getJid().asBareJid();
         CachedDeviceList theirDevices
         = mOmemoStore.loadCachedDeviceList(mOmemoManager, recipient);
         for (int id : theirDevices.getActiveDevices()) {
         OmemoDevice recipientDevice = new OmemoDevice(recipient, id);
         try {
         fingerPrint = mOmemoManager.getFingerprint(recipientDevice);
         allTrusted = mOmemoManager.isTrustedOmemoIdentity(recipientDevice, fingerPrint)
         && allTrusted;
         }
         catch (CannotEstablishOmemoSessionException e1) {
         logger.warn("AllTrusted check exception: " + e1.getMessage());
         }
        }
        }
         return allTrusted;
      }

       

      May be smack Omemo would consider to include the unTrusted devices in UndecidedOmemoIdentityException#getUntrustedDevices().

       

      ========= OMEMO encrypted chat message to untrusted device =================

      07-11 14:54:31.432 D/SMACK: SENT (0): <message to='swan@atalk.org' id='sTTpC-283' type='chat'><body>I sent you an OMEMO encrypted message but your client doesn’t seem to support that. Find more information on https://conversations.im/omemo</body><thread>a922d234-89c8-491b-b665-969f064050e8</thread><encrypted xmlns='eu.siacs.conversations.axolotl'><header sid='1011347036'><iv>FudDR5iu+XgFvFvgR2XzOA==</iv></header><payload>SZs=</paylo ad></encrypted><store xmlns='urn:xmpp:hints'/><encryption xmlns='urn:xmpp:eme:0' namespace='eu.siacs.conversations.axolotl' name='OMEMO'/></message><r xmlns='urn:xmpp:sm:3'/>

       

      ========= OMEMO encrypted MUC message to ntrusted device =================

      07-12 09:44:46.471 D/SMACK: SENT (1): <message to='chatroom@conference.atalk.org' id='Y78BR-281' type='groupchat'><body>I sent you an OMEMO encrypted message but your client doesn’t seem to support that. Find more information on https://conversations.im/omemo</body><encrypted xmlns='eu.siacs.conversations.axolotl'><header sid='1011347036'><key rid='1796289951'>MwohBahtoHlbzwR7oy0flhpXOMGULr8t+/visw5W1xAlerV1EAEYBCIwVxoJ0w xZbI7QbKzMuYPpuLkXia0c4AAGcXpfQqGWB9w1U6tD5tGe5L3s5iBIcf/H7o9igDVg1EQ=</key><iv> 9wHU010d+g9XSvmOTQWqrw==</iv></header><payload>rbLiavI=</payload></encrypted><st ore xmlns='urn:xmpp:hints'/><encryption xmlns='urn:xmpp:eme:0' namespace='eu.siacs.conversations.axolotl' name='OMEMO'/></message><r xmlns='urn:xmpp:sm:3'/>

        • Re: Smack OMEMO UndecidedOmemoIdentityException#getUntrustedDevices returns only undecidedOmemoIdentity
          Paul Schaub

          Sorry for the method name being missleading. It should be named "getUndecidedDevices()" instead.

          The purpose of the method is to return all the undecided devices of the recipient(s), so the user can make a decision. The user should not be bothered to trust already untrusted devices once again.

           

          The Exception is thrown when there is at least one undecided device among the recipient devices. In such a case the message gets not sent at all. The user first has to decide whether to trust the device or not and then try again. The client should keep the message in the text box, so the user does not lose the text they wrote.

            • Re: Smack OMEMO UndecidedOmemoIdentityException#getUntrustedDevices returns only undecidedOmemoIdentity
              cmeng

              Sorry for the confusion, actually I am not so much into the naming of the method.

               

              In aTalk implementation, an UI is provided to allow user to mark a omemoDevice as untrusted in respective of its previous trust state i.e.

              UNDECIDED, TRUSTED or VERIFIED. If the user later starts a omemo session with the buddy having only a single untrusted omemDevice; all messages entered by the user appear to have been sent, but the transmitted Olm messages are not received by his buddy. The user will wonder why he receives no reply from his buddy (user may have forgotten he has earlier marked his buddy only device as untrusted). aTalk performs a pre-check on untrusted devices, and display a system message on the chat window to that effect if none of the buddy devices are able to receive the olm messages.

               

              Personally I am not sure if the above implementation has deviated from the XEP-0384 standards, but thinking that it may be good for smack OMEMO to consider such pre-check for untrusted devices and throw an untrustedException.