Beispiel #1
0
        public static void ReadClientHello(ref ReadableBuffer readable, IConnectionState connectionState)
        {
            readable = readable.Slice(HandshakeProcessor.HandshakeHeaderSize);
            readable = readable.Slice(sizeof(ushort));
            connectionState.SetClientRandom(readable.Slice(0, RandomLength));
            readable = readable.Slice(RandomLength);
            //We don't support sessions via id so slice and throw
            BufferExtensions.SliceVector <byte>(ref readable);
            //Slice Cipher Suite
            var ciphers = BufferExtensions.SliceVector <ushort>(ref readable);

            if (connectionState.CipherSuite == null)
            {
                connectionState.CipherSuite = connectionState.CryptoProvider.GetCipherSuiteFromExtension(ciphers, connectionState.Version);
            }
            //Skip compression
            BufferExtensions.SliceVector <byte>(ref readable);
        }