Example #1
0
        public override void ProcessServerExtensions(IDictionary clientExtensions)
        {
            base.ProcessServerExtensions(clientExtensions);

            // set to some reasonable default value
            int         chosenProfile  = SrtpProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_80;
            UseSrtpData clientSrtpData = TlsSRTPUtils.GetUseSrtpExtension(clientExtensions);

            foreach (int profile in clientSrtpData.ProtectionProfiles)
            {
                switch (profile)
                {
                case SrtpProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_32:
                case SrtpProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_80:
                case SrtpProtectionProfile.SRTP_NULL_HMAC_SHA1_32:
                case SrtpProtectionProfile.SRTP_NULL_HMAC_SHA1_80:
                    chosenProfile = profile;
                    break;
                }
            }

            // server chooses a mutually supported SRTP protection profile
            // http://tools.ietf.org/html/draft-ietf-avt-dtls-srtp-07#section-4.1.2
            int[] protectionProfiles = { chosenProfile };

            // server agrees to use the MKI offered by the client
            clientSrtpData = new UseSrtpData(protectionProfiles, clientSrtpData.Mki);
        }
Example #2
0
        public override void ProcessClientExtensions(IDictionary clientExtensions)
        {
            base.ProcessClientExtensions(clientExtensions);
            var useSrtpData        = TlsSRTPUtils.GetUseSrtpExtension(clientExtensions);
            var protectionProfiles = useSrtpData.ProtectionProfiles;

            ChosenSrtpProtectionProfile = DtlsUtils.ChooseSrtpProtectionProfile(SrtpConfig.ProtectionProfiles, protectionProfiles);
        }
Example #3
0
        public override IDictionary GetServerExtensions()
        {
            var extensions = base.GetServerExtensions() ?? new Dictionary <int, byte[]>();

            if (TlsSRTPUtils.GetUseSrtpExtension(extensions) == null)
            {
                TlsSRTPUtils.AddUseSrtpExtension(extensions, new UseSrtpData(new int[] { ChosenSrtpProtectionProfile }, TlsUtilities.EmptyBytes));
            }
            return(extensions);
        }
Example #4
0
        public override IDictionary GetServerExtensions()
        {
            Hashtable serverExtensions = (Hashtable)base.GetServerExtensions();

            if (TlsSRTPUtils.GetUseSrtpExtension(serverExtensions) == null)
            {
                if (serverExtensions == null)
                {
                    serverExtensions = new Hashtable();
                }
                TlsSRTPUtils.AddUseSrtpExtension(serverExtensions, serverSrtpData);
            }
            return(serverExtensions);
        }
Example #5
0
        public override IDictionary GetClientExtensions()
        {
            var clientExtensions = base.GetClientExtensions();

            if (TlsSRTPUtils.GetUseSrtpExtension(clientExtensions) == null)
            {
                if (clientExtensions == null)
                {
                    clientExtensions = new Hashtable();
                }

                TlsSRTPUtils.AddUseSrtpExtension(clientExtensions, clientSrtpData);
            }
            return(clientExtensions);
        }
Example #6
0
        public override IDictionary GetClientExtensions()
        {
            var clientExtensions = base.GetClientExtensions();

            if (TlsSRTPUtils.GetUseSrtpExtension(clientExtensions) == null)
            {
                if (clientExtensions == null)
                {
                    clientExtensions = new Dictionary <int, byte[]>();
                }

                TlsSRTPUtils.AddUseSrtpExtension(clientExtensions, new UseSrtpData(SrtpConfig.ProtectionProfiles.ToArray(), TlsUtilities.EmptyBytes));
            }
            clientExtensions[ExtensionType.renegotiation_info] = new byte[] { 0 };
            return(clientExtensions);
        }