Exemplo n.º 1
0
        protected override void ProcessAsTls1()
        {
            this.processProtocol(this.ReadInt16());
            this.random = this.ReadBytes(32);
            int count = (int)this.ReadByte();

            if (count > 0)
            {
                this.sessionId = this.ReadBytes(count);
                ClientSessionCache.Add(this.Context.ClientSettings.TargetHost, this.sessionId);
                this.Context.AbbreviatedHandshake = HandshakeMessage.Compare(this.sessionId, this.Context.SessionId);
            }
            else
            {
                this.Context.AbbreviatedHandshake = false;
            }
            short code = this.ReadInt16();

            if (this.Context.SupportedCiphers.IndexOf(code) == -1)
            {
                throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid cipher suite received from server");
            }
            this.cipherSuite       = this.Context.SupportedCiphers[code];
            this.compressionMethod = (SecurityCompressionType)this.ReadByte();
        }
Exemplo n.º 2
0
        protected override void ProcessAsTls1()
        {
            processProtocol(ReadInt16());
            random = ReadBytes(32);
            int num = ReadByte();

            if (num > 0)
            {
                sessionId = ReadBytes(num);
                ClientSessionCache.Add(base.Context.ClientSettings.TargetHost, sessionId);
                base.Context.AbbreviatedHandshake = HandshakeMessage.Compare(sessionId, base.Context.SessionId);
            }
            else
            {
                base.Context.AbbreviatedHandshake = false;
            }
            short code = ReadInt16();

            if (base.Context.SupportedCiphers.IndexOf(code) == -1)
            {
                throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid cipher suite received from server");
            }
            cipherSuite       = base.Context.SupportedCiphers[code];
            compressionMethod = (SecurityCompressionType)ReadByte();
        }
Exemplo n.º 3
0
        protected override void ProcessAsTls1()
        {
            // Read protocol version
            this.processProtocol(this.ReadInt16());

            // Read random  - Unix time + Random bytes
            this.random = this.ReadBytes(32);

            // Read Session id
            int length = (int)ReadByte();

            if (length > 0)
            {
                this.sessionId = this.ReadBytes(length);
                ClientSessionCache.Add(this.Context.ClientSettings.TargetHost, this.sessionId);
                this.Context.AbbreviatedHandshake = Compare(this.sessionId, this.Context.SessionId);
            }
            else
            {
                this.Context.AbbreviatedHandshake = false;
            }

            // Read cipher suite
            short cipherCode = this.ReadInt16();

            if (this.Context.SupportedCiphers.IndexOf(cipherCode) == -1)
            {
                // The server has sent an invalid ciphersuite
                throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid cipher suite received from server");
            }
            this.cipherSuite = this.Context.SupportedCiphers[cipherCode];

            // Read compression methods ( always 0 )
            this.compressionMethod = (SecurityCompressionType)this.ReadByte();
        }