Exemple #1
0
        public void HandleHello(HelloExtension hello)
        {
            SecurityAssert.Assert(hello.Data.Length > 1);
            var length = hello.Data[0];

            SecurityAssert.Assert(length > 0 && hello.Data.Length == length + 1);

            var list = new List <ECPointFormat>();

            for (var i = 1; i < hello.Data.Length; i++)
            {
                list.Add((ECPointFormat)hello.Data[i]);
            }

            _ecPointFormatsConfig.SupportedPointFormats = list;
        }
        public void HandleHello(HelloExtension hello)
        {
            SecurityAssert.Assert(_endConfig.End == ConnectionEnd.Server);

            SecurityAssert.Assert(hello.Data.Length > 2);
            var length = EndianBitConverter.Big.ToUInt16(hello.Data, 0);

            SecurityAssert.Assert(length > 1 && hello.Data.Length == length + 2);

            var list = new List <NamedCurve>();

            for (var i = 2; i < hello.Data.Length; i += 2)
            {
                var id = EndianBitConverter.Big.ToUInt16(hello.Data, i);
                list.Add((NamedCurve)id);
            }

            _supportedGroupsConfig.SupportedGroups = list;
        }
Exemple #3
0
        public void HandleHello(HelloExtension hello)
        {
            SecurityAssert.Assert(_endConfig.End == ConnectionEnd.Server);

            var algorithms = new List <(TLSHashAlgorithm, TLSSignatureAlgorithm)>();

            var length = EndianBitConverter.Big.ToUInt16(hello.Data, 0);

            SecurityAssert.Assert(length % 2 == 0 && length >= 4);

            var count = length / 2;

            for (var i = 0; i < count; i++)
            {
                var hash = (TLSHashAlgorithm)hello.Data[2 * i + 2];
                var sig  = (TLSSignatureAlgorithm)hello.Data[2 * i + 3];

                algorithms.Add((hash, sig));
            }

            _config.SupportedAlgorithms = algorithms.Where(IsSupported).ToList();
        }