Search in sources :

Example 6 with IceUdpTransportInfo

use of eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo in project Conversations by siacs.

the class RtpContentMap method transportInfo.

RtpContentMap transportInfo(final String contentName, final IceUdpTransportInfo.Candidate candidate) {
    final RtpContentMap.DescriptionTransport descriptionTransport = contents.get(contentName);
    final IceUdpTransportInfo transportInfo = descriptionTransport == null ? null : descriptionTransport.transport;
    if (transportInfo == null) {
        throw new IllegalArgumentException("Unable to find transport info for content name " + contentName);
    }
    final IceUdpTransportInfo newTransportInfo = transportInfo.cloneWrapper();
    newTransportInfo.addChild(candidate);
    return new RtpContentMap(null, ImmutableMap.of(contentName, new DescriptionTransport(null, newTransportInfo)));
}
Also used : IceUdpTransportInfo(eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo) OmemoVerifiedIceUdpTransportInfo(eu.siacs.conversations.xmpp.jingle.stanzas.OmemoVerifiedIceUdpTransportInfo)

Example 7 with IceUdpTransportInfo

use of eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo in project Conversations by siacs.

the class RtpContentMap method requireDTLSFingerprint.

void requireDTLSFingerprint(final boolean requireActPass) {
    if (this.contents.size() == 0) {
        throw new IllegalStateException("No contents available");
    }
    for (Map.Entry<String, DescriptionTransport> entry : this.contents.entrySet()) {
        final IceUdpTransportInfo transport = entry.getValue().transport;
        final IceUdpTransportInfo.Fingerprint fingerprint = transport.getFingerprint();
        if (fingerprint == null || Strings.isNullOrEmpty(fingerprint.getContent()) || Strings.isNullOrEmpty(fingerprint.getHash())) {
            throw new SecurityException(String.format("Use of DTLS-SRTP (XEP-0320) is required for content %s", entry.getKey()));
        }
        final IceUdpTransportInfo.Setup setup = fingerprint.getSetup();
        if (setup == null) {
            throw new SecurityException(String.format("Use of DTLS-SRTP (XEP-0320) is required for content %s but missing setup attribute", entry.getKey()));
        }
        if (requireActPass && setup != IceUdpTransportInfo.Setup.ACTPASS) {
            throw new SecurityException("Initiator needs to offer ACTPASS as setup for DTLS-SRTP (XEP-0320)");
        }
    }
}
Also used : IceUdpTransportInfo(eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo) OmemoVerifiedIceUdpTransportInfo(eu.siacs.conversations.xmpp.jingle.stanzas.OmemoVerifiedIceUdpTransportInfo) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map)

Aggregations

IceUdpTransportInfo (eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo)7 OmemoVerifiedIceUdpTransportInfo (eu.siacs.conversations.xmpp.jingle.stanzas.OmemoVerifiedIceUdpTransportInfo)5 Map (java.util.Map)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 ImmutableList (com.google.common.collect.ImmutableList)2 OmemoVerification (eu.siacs.conversations.xmpp.jingle.OmemoVerification)2 RtpDescription (eu.siacs.conversations.xmpp.jingle.stanzas.RtpDescription)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 Element (eu.siacs.conversations.xml.Element)1 OmemoVerifiedRtpContentMap (eu.siacs.conversations.xmpp.jingle.OmemoVerifiedRtpContentMap)1 RtpContentMap (eu.siacs.conversations.xmpp.jingle.RtpContentMap)1 Group (eu.siacs.conversations.xmpp.jingle.stanzas.Group)1 HashMap (java.util.HashMap)1 IceCandidate (org.webrtc.IceCandidate)1 SessionBuilder (org.whispersystems.libsignal.SessionBuilder)1