Which encryption method we are using in smack android sdk for chat messages

Hi,

I would like to know which encryption method we are using in smack android sdk 4.4.4 for chat messages

Thanks
Firoz Saifi

If you have to ask, then the answer is probably none (besides the hop-to-hop transport encryption, TLS).

so is there any way to add some other encryption in chats, if you can guide, it would be helpful

I suspect that you are interested in end-to-end encryption. How this can be applied to Smack is documented at Smack/omemo.md at master · igniterealtime/Smack · GitHub

Thanks for this. So now i will have to rewrite all code

Hi, thank you for this link. I am using multi user chat in my application. In the link, there is nothing mentioned about how to send encrypted message to MUC. If you have any ref to send encrypted message to muc then can you please share??

Can you explain exactly what information that you are missing? That document has a section titled “Encrypt a Message for Multi User Chat”. That exactly matches how I interpret your message.

That’s about encrypting a message that is done from my side also. Now there is next section after this section - “Sending an encrypted Message” - This sections contains to make the Message object of encrypted message and send to jid using connection object but there is no information about how can we convert the encrypted message to Message object for muc and send that object to muc

Doesn’t that use the same method?

i dont think so as currently we use muc object to send message in muc and we use connection to send message to one to one

I’ve asked the developer that build that implementation. Their response:

There is Smack/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java at master · igniterealtime/Smack · GitHub

So sending a message to a muc would be something along the lines of:

MessageBuilder msg = muc.buildMessage();
OmemoMessage.Sent omemoPart = omemoManager.encrypt(muc, "Hello");
muc.sendMessage(omemoPart.buildMessage(msg));

But no guarantees and maybe the omemoPart.buildMessage() is tailored to 1:1 messages (type=chat), so this would need to be manually changed

There are two points-

  1. omemoPart.buildMessage(MessageBuilder messageBuilder, Jid recipient) - it takes two parameters whereas in the mentioned response we have passed only msg object so it is wrong and it is not accepting single argument

  2. omemoPart.buildMessage(MessageBuilder messageBuilder, Jid recipient) - As you said it is tailored to 1:1 messages. Yes I have checked this function and found that it has this line - messageBuilder.ofType(Message.Type.chat).to(recipient) which indicates that it is for 1:1.

So again question remains the same that how can i send encrypted message in muc?? or what do i need to modify and how can i do that as we can’t modified imported dependency. Does it support omemo in muc completely??

I would be grateful to you if you help me to get it resolved.

Thanks

If I were you I’d try to look for some good examples on github. The ones I like are:

  1. omemo-muc, simple, and therefore best to start with
  2. aTalk, complete Android app and hence, more code to review.
2 Likes

Yes i looked over the internet but unfortunately didn’t found these examples. Thank you so much for these examples hope this will help me

It worked now i am able to send the ecnrypted message. Thanks a lot

1 Like

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.