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(); }
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(); }
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(); }
public virtual void Clear() { this.compressionMethod = SecurityCompressionType.None; this.serverSettings = new TlsServerSettings(); this.clientSettings = new TlsClientSettings(); this.handshakeMessages = new TlsStream(); this.sessionId = (byte[])null; this.handshakeState = HandshakeState.None; this.ClearKeyInfo(); }
public virtual void Clear() { compressionMethod = SecurityCompressionType.None; serverSettings = new TlsServerSettings(); clientSettings = new TlsClientSettings(); handshakeMessages = new TlsStream(); sessionId = null; handshakeState = HandshakeState.None; ClearKeyInfo(); }
public Context(SecurityProtocolType securityProtocolType) { this.SecurityProtocol = securityProtocolType; this.compressionMethod = SecurityCompressionType.None; this.serverSettings = new TlsServerSettings(); this.clientSettings = new TlsClientSettings(); this.handshakeMessages = new TlsStream(); this.sessionId = null; this.handshakeState = HandshakeState.None; this.random = RandomNumberGenerator.Create(); }
public virtual void Clear() { this.compressionMethod = SecurityCompressionType.None; this.serverSettings = new TlsServerSettings(); this.clientSettings = new TlsClientSettings(); this.handshakeMessages = new TlsStream(); this.sessionId = null; this.handshakeState = HandshakeState.None; this.ClearKeyInfo(); }
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); } // 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(); }
/* public SecurityCompressionType CompressionMethod { get { return this.compressionMethod; } set { if (value != SecurityCompressionType.None) { throw new NotSupportedException("Specified compression method is not supported"); } this.compressionMethod = value; } } */ #endregion #region Constructors public TlsClientSettings() { this.compressionMethod = SecurityCompressionType.None; this.certificates = new X509CertificateCollection(); this.targetHost = String.Empty; }