powered by Jive Software

Sending of encrypted message and encrypted audio video call with smack 4.4.0

Hello,
i am trying to use smack 4.4.0 with android. For now, here is what I can do:
-connect to the server
-authenticate me and send an unencrypted message

My server is ejabberd.

Now I want to use OMEMO to encrypt the messages. I see there is OpenGPG. I don’t know which is more effective, so I took OMEMO.
But I can’t send an encrypted message.
I’ve been looking for 4 days and trying to understand. Now I need help.
Here is the tutorial I followed: https://github.com/igniterealtime/Smack/blob/master/documentation/extensions/omemo.md

I’m desperate, really desperate.
Here are the dependencies I am using in android studio:

implementation ‘org.igniterealtime.smack: smack-sasl-provided: 4.4.0’
implementation ‘org.igniterealtime.smack: smack-resolver-dnsjava: 4.4.0’
implementation ‘org.igniterealtime.smack: smack-openpgp: 4.4.0’
implementation ‘org.igniterealtime.smack: smack-android: 4.4.0’
implementation ‘org.igniterealtime.smack: smack-im: 4.4.0’
implementation ‘org.igniterealtime.smack: smack-xmlparser-xpp3: 4.4.0’
// implementation ‘org.igniterealtime.smack: smack-jingle-old: 4.4.0’
/ * testImplementation ‘junit: junit: 4.13.2’
androidTestImplementation ‘androidx.test.ext: junit: 1.1.2’
androidTestImplementation ‘androidx.test.espresso: espresso-core: 3.3.0’ * /

implementation 'org.igniterealtime.smack: smack-tcp: 4.4.0'
implementation 'org.igniterealtime.smack: smack-android-extensions: 4.4.0'
implementation 'org.igniterealtime.smack: smack-omemo-signal: 4.4.0'

In the tutorial I followed in https://github.com/igniterealtime/Smack/blob/master/documentation/extensions/omemo.md, there is a Message message = encrypted.asMessage (contactsJid) instruction; but I can’t find the asMessage method in OmemoMessage.sent, so I don’t know what to do

Help me with an example or a tutorial for the smack.4.4.0 version or if I need to change dependencies in my build.gradle

Sincerely I hope a lot on you

PS: After that I want to implement the audio and video call: if I have sources or tutorials at the same time, I would be satisfied.

Thanks thanks

In Case you are interested in OpenPGP then there is thread I started and have sample code. I will try to find out later but search should help you on that. As of general Encryption with Smack, I have found OMEMO license as not friendly to closed source software. OpenPGP (OX IM) is free but does not yet support Group chats. So you can only encrypt On-on-One messages only!

Thank you for responding already. I try openPgp later, for now I wanted to contribute new information.
In DEBUG mode, I noticed a negative bundle:

<iq to='user@domain.net 'id =' DULES-12 'type =' get '>
       <query xmlns = 'http: //jabber.org/protocol/disco#info' node = 'eu.siacs.conversations.axolotl.**bundles:-1**'>
       </query>
     </iq>

It’s normal?
If not, how to solve this.
In fact I use an android emulator and a huawei phone for my tests
I confirm that the bundle: -1 comes from the huawei, not from the emulator, because when I display the device of each one, for the huawei I have this:
user@domain.net:-1
and that of the emulator is:
user2@domain.net:21137227720
Isn’t that the problem?
Here is the error I get:
user2@domain.net:21137227720 cannot establish session with user@domain.net:-1 because their bundle could not be fetched.

For the Bundle it’s ok (I don’t know how I did it or it’s gone by itself)
But the following error still persists:

user2@domain.net: 21137227720 cannot establish session with user@domain.net: -1 because their bundle could not be fetched.

“device” is the device of the contact that I extract via

  jid = JidCreate.entityBareFrom ("user@domain.net/Smack");
                    omemoManager.requestDeviceListUpdateFor (jid);
                    Set <OmemoDevice> contactDevices = omemoManager.getDevicesOf (jid);                    
                    for (OmemoDevice device: contactDevices) {                        
                        // omemoManager = OmemoManager.getInstanceFor (connectXMPP, dev.getDeviceId ());
                        //omemoManager.rebuildSessionWith(dev);
                        OmemoFingerprint fingerprint = omemoManager.getFingerprint (device);
                        omemoManager.trustOmemoIdentity (device, fingerprint);
                        //break;
                    }

And the line that causes this is:

OmemoFingerprint fingerprint = omemoManager.getFingerprint (device);

PS: Can I get the article on openPGP with smack SVP?

Hm, a the -1 as bundle ID looks very wrong. I guess something went wrong when initalizing the OmemoManager.

I can always recommend users to take a look at the integration tests to understand how to use the API: https://github.com/igniterealtime/Smack/tree/master/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo

There is some DSL (AbstractTwoUsersOmemoTest, OmemoSetupHelper) to make the testing easier, but you should be able to understand the requirements from looking at the tests.

1 Like

thank you very much
With OpenPGP it’s easier.
Just one question: can I continue with openPgp safely for reliable secure communication? really reliable?
Could I make audio and video calls with OpenPGP?
If so I will rather use OpenPGP and leave OMEMo for later

In any case, thank you for the link which helped me a lot, in one evening I was able to understand and implement the concept.

I can send an encrypted message via OpenPgP.

If you reassure me that I can use this safely then I’ll go for it. Also what are the limits compared to OMEMO?

Now how to make audio and video calls?