Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call encryption using SDES fails. #91

Closed
MilanKral opened this issue Jan 24, 2020 · 3 comments
Closed

Call encryption using SDES fails. #91

MilanKral opened this issue Jan 24, 2020 · 3 comments

Comments

@MilanKral
Copy link
Contributor

Call encryption using SDES (without DTLS-SRTP, ZRTP) fails.

Maybe the Base64.decodeBase64 method is missing trailing =

According to
https://xmpp.org/extensions/xep-0167.html#srtp
and RFC 4568 [Page 13]
in the inline key method one or two "=" at the end of the base64-encoded data are discarded. (see [RFC3548] for details)

E/AndroidRuntime: FATAL EXCEPTION: Thread-318 Process: org.atalk.android, PID: 17114 java.lang.NoSuchMethodError: No static method decodeBase64(Ljava/lang/String;)[B in class Lorg/apache/commons/codec/binary/Base64; or its super classes (declaration of 'org.apache.commons.codec.binary.Base64' appears in /system/framework/org.apache.http.legacy.boot.jar) at ch.imvs.sdes4j.srtp.SrtpKeyParam.<init>(SrtpKeyParam.java:83) at ch.imvs.sdes4j.srtp.SrtpSDesFactory.createKeyParam(SrtpSDesFactory.java:93) at ch.imvs.sdes4j.srtp.SrtpSDesFactory.createKeyParam(SrtpSDesFactory.java:27) at ch.imvs.sdes4j.CryptoAttribute.setKeyParams(CryptoAttribute.java:191) at ch.imvs.sdes4j.CryptoAttribute.create(CryptoAttribute.java:81) at ch.imvs.sdes4j.srtp.SrtpCryptoAttribute.create(SrtpCryptoAttribute.java:38) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.selectSdesCryptoSuite(CallPeerMediaHandlerJabberImpl.java:2215) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.addSDesAdvertisedEncryptions(CallPeerMediaHandlerJabberImpl.java:2170) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.setAndAddPreferredEncryptionProtocol(CallPeerMediaHandlerJabberImpl.java:2417) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.setAndAddPreferredEncryptionProtocol(CallPeerMediaHandlerJabberImpl.java:1856) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.processOffer(CallPeerMediaHandlerJabberImpl.java:1322) at net.java.sip.communicator.impl.protocol.jabber.CallPeerJabberImpl.processSessionInitiate(CallPeerJabberImpl.java:682) at net.java.sip.communicator.impl.protocol.jabber.CallJabberImpl.processSessionInitiate(CallJabberImpl.java:741) at net.java.sip.communicator.impl.protocol.jabber.OperationSetBasicTelephonyJabberImpl$2.run(OperationSetBasicTelephonyJabberImpl.java:808) E/(UtilActivator.java:90)#uncaughtException: An uncaught exception occurred in thread = Thread[Thread-318,5,main] and message was: No static method decodeBase64(Ljava/lang/String;)[B in class Lorg/apache/commons/codec/binary/Base64; or its super classes (declaration of 'org.apache.commons.codec.binary.Base64' appears in /system/framework/org.apache.http.legacy.boot.jar) java.lang.NoSuchMethodError: No static method decodeBase64(Ljava/lang/String;)[B in class Lorg/apache/commons/codec/binary/Base64; or its super classes (declaration of 'org.apache.commons.codec.binary.Base64' appears in /system/framework/org.apache.http.legacy.boot.jar) at ch.imvs.sdes4j.srtp.SrtpKeyParam.<init>(SrtpKeyParam.java:83) at ch.imvs.sdes4j.srtp.SrtpSDesFactory.createKeyParam(SrtpSDesFactory.java:93) at ch.imvs.sdes4j.srtp.SrtpSDesFactory.createKeyParam(SrtpSDesFactory.java:27) at ch.imvs.sdes4j.CryptoAttribute.setKeyParams(CryptoAttribute.java:191) at ch.imvs.sdes4j.CryptoAttribute.create(CryptoAttribute.java:81) at ch.imvs.sdes4j.srtp.SrtpCryptoAttribute.create(SrtpCryptoAttribute.java:38) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.selectSdesCryptoSuite(CallPeerMediaHandlerJabberImpl.java:2215) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.addSDesAdvertisedEncryptions(CallPeerMediaHandlerJabberImpl.java:2170) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.setAndAddPreferredEncryptionProtocol(CallPeerMediaHandlerJabberImpl.java:2417) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.setAndAddPreferredEncryptionProtocol(CallPeerMediaHandlerJabberImpl.java:1856) at net.java.sip.communicator.impl.protocol.jabber.CallPeerMediaHandlerJabberImpl.processOffer(CallPeerMediaHandlerJabberImpl.java:1322) at net.java.sip.communicator.impl.protocol.jabber.CallPeerJabberImpl.processSessionInitiate(CallPeerJabberImpl.java:682) at net.java.sip.communicator.impl.protocol.jabber.CallJabberImpl.processSessionInitiate(CallJabberImpl.java:741) at net.java.sip.communicator.impl.protocol.jabber.OperationSetBasicTelephonyJabberImpl$2.run(OperationSetBasicTelephonyJabberImpl.java:808)

@MilanKral
Copy link
Contributor Author

Thiswas just a incorrect build.

@cmeng-git
Copy link
Owner

cmeng-git commented Jan 26, 2020

Actually the problem is that the SDES library call the Base64.decodeBase64, and the declaration has conflict between commons-decode library and the embedded code in android /system/framework which is incomplete.

(declaration of 'org.apache.commons.codec.binary.Base64' appears in /system/framework/org.apache.http.legacy.boot.jar)

Because of this conflict, android studio built does not warn of missing library or just discards the commons-library, hence causes the problem for the SDES feature.

I am now study whether to keep SDES support or just remove the feature. aTalk is forked from jitsi, and found that jitsi latest built has discarded the SDES support.

Please see
auth0/java-jwt#131

@cmeng-git
Copy link
Owner

Solution implemented, will be in aTalk next version release

MilanKral added a commit to MilanKral/atalk-android that referenced this issue Jan 29, 2020
cmeng-git#91

After the fix SDES works correctly.

The library ch.imvs.sdes4j is directly included in the source code.
Imports for org.apache.commons.codec.binary are replaced with
a local copy org2.apache.commons.codec.binary .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants