Example #1
0
        public static int[] ReadSupportedEllipticCurvesExtension(byte[] extensionData)
        {
            if (extensionData == null)
            {
                throw new ArgumentNullException("extensionData");
            }

            MemoryStream buf = new MemoryStream(extensionData, false);

            int length = TlsUtilities.ReadUint16(buf);

            if (length < 2 || (length & 1) != 0)
            {
                throw new TlsFatalAlert(AlertDescription.decode_error);
            }

            int[] namedCurves = TlsUtilities.ReadUint16Array(length / 2, buf);

            TlsProtocol.AssertEmpty(buf);

            return(namedCurves);
        }
Example #2
0
        public static byte[] ReadNegotiatedDheGroupsClientExtension(byte[] extensionData)
        {
            if (extensionData == null)
            {
                throw new ArgumentNullException("extensionData");
            }

            MemoryStream buf = new MemoryStream(extensionData, false);

            byte length = TlsUtilities.ReadUint8(buf);

            if (length < 1)
            {
                throw new TlsFatalAlert(AlertDescription.decode_error);
            }

            byte[] dheGroups = TlsUtilities.ReadUint8Array(length, buf);

            TlsProtocol.AssertEmpty(buf);

            return(dheGroups);
        }