public virtual void Connect(TlsClient tlsClient) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (tlsClient == null) { throw new ArgumentNullException("tlsClient"); } if (mTlsClient != null) { throw new InvalidOperationException("'Connect' can only be called once"); } mTlsClient = tlsClient; mSecurityParameters = new SecurityParameters(); mSecurityParameters.entity = 1; mTlsClientContext = new TlsClientContextImpl(mSecureRandom, mSecurityParameters); mSecurityParameters.clientRandom = TlsProtocol.CreateRandomBlock(tlsClient.ShouldUseGmtUnixTime(), mTlsClientContext.NonceRandomGenerator); mTlsClient.Init(mTlsClientContext); mRecordStream.Init(mTlsClientContext); TlsSession sessionToResume = tlsClient.GetSessionToResume(); if (sessionToResume != null && sessionToResume.IsResumable) { SessionParameters sessionParameters = sessionToResume.ExportSessionParameters(); if (sessionParameters != null) { mTlsSession = sessionToResume; mSessionParameters = sessionParameters; } } SendClientHelloMessage(); mConnectionState = 1; BlockForHandshake(); }
public virtual void Connect(TlsClient tlsClient) { if (tlsClient == null) { throw new ArgumentNullException("tlsClient"); } if (this.mTlsClient != null) { throw new InvalidOperationException("'Connect' can only be called once"); } this.mTlsClient = tlsClient; base.mSecurityParameters = new SecurityParameters(); base.mSecurityParameters.entity = 1; this.mTlsClientContext = new TlsClientContextImpl(base.mSecureRandom, base.mSecurityParameters); base.mSecurityParameters.clientRandom = TlsProtocol.CreateRandomBlock(tlsClient.ShouldUseGmtUnixTime(), this.mTlsClientContext.NonceRandomGenerator); this.mTlsClient.Init(this.mTlsClientContext); base.mRecordStream.Init(this.mTlsClientContext); TlsSession sessionToResume = tlsClient.GetSessionToResume(); if ((sessionToResume != null) && sessionToResume.IsResumable) { SessionParameters parameters = sessionToResume.ExportSessionParameters(); if (parameters != null) { base.mTlsSession = sessionToResume; base.mSessionParameters = parameters; } } this.SendClientHelloMessage(); base.mConnectionState = 1; this.BlockForHandshake(); }
/** * Initiates a TLS handshake in the role of client.<br/> * <br/> * In blocking mode, this will not return until the handshake is complete. * In non-blocking mode, use {@link TlsPeer#NotifyHandshakeComplete()} to * receive a callback when the handshake is complete. * * @param tlsClient The {@link TlsClient} to use for the handshake. * @throws IOException If in blocking mode and handshake was not successful. */ public virtual void Connect(TlsClient tlsClient) { if (tlsClient == null) { throw new ArgumentNullException("tlsClient"); } if (this.mTlsClient != null) { throw new InvalidOperationException("'Connect' can only be called once"); } this.mTlsClient = tlsClient; base.LoggingContext = this.mTlsClient.LoggingContext; if (HTTPManager.Logger.Level <= Loglevels.All) { HTTPManager.Logger.Verbose("TlsClientProtocol", "Connect", this.LoggingContext); } this.mSecurityParameters = new SecurityParameters(); this.mSecurityParameters.entity = ConnectionEnd.client; this.mTlsClientContext = new TlsClientContextImpl(mSecureRandom, mSecurityParameters); this.mTlsClientContext.UserObject = this.LoggingContext; this.mSecurityParameters.clientRandom = CreateRandomBlock(tlsClient.ShouldUseGmtUnixTime(), mTlsClientContext.NonceRandomGenerator); this.mTlsClient.Init(mTlsClientContext); this.mRecordStream.Init(mTlsClientContext); tlsClient.NotifyCloseHandle(this); TlsSession sessionToResume = tlsClient.GetSessionToResume(); if (sessionToResume != null && sessionToResume.IsResumable) { SessionParameters sessionParameters = sessionToResume.ExportSessionParameters(); if (sessionParameters != null && sessionParameters.IsExtendedMasterSecret) { this.mTlsSession = sessionToResume; this.mSessionParameters = sessionParameters; } } SendClientHelloMessage(); this.mConnectionState = CS_CLIENT_HELLO; BlockForHandshake(); }
/** * Initiates a TLS handshake in the role of client * * @param tlsClient The {@link TlsClient} to use for the handshake. * @throws IOException If handshake was not successful. */ public virtual void Connect(TlsClient tlsClient) { if (tlsClient == null) { throw new ArgumentNullException("tlsClient"); } if (this.mTlsClient != null) { throw new InvalidOperationException("'Connect' can only be called once"); } this.mTlsClient = tlsClient; this.mSecurityParameters = new SecurityParameters(); this.mSecurityParameters.entity = ConnectionEnd.client; this.mTlsClientContext = new TlsClientContextImpl(mSecureRandom, mSecurityParameters); this.mSecurityParameters.clientRandom = CreateRandomBlock(tlsClient.ShouldUseGmtUnixTime(), mTlsClientContext.NonceRandomGenerator); this.mTlsClient.Init(mTlsClientContext); this.mRecordStream.Init(mTlsClientContext); TlsSession sessionToResume = tlsClient.GetSessionToResume(); if (sessionToResume != null && sessionToResume.IsResumable) { SessionParameters sessionParameters = sessionToResume.ExportSessionParameters(); if (sessionParameters != null) { this.mTlsSession = sessionToResume; this.mSessionParameters = sessionParameters; } } SendClientHelloMessage(); this.mConnectionState = CS_CLIENT_HELLO; CompleteHandshake(); }
/** * Initiates a TLS handshake in the role of client * * @param tlsClient The {@link TlsClient} to use for the handshake. * @throws IOException If handshake was not successful. */ public virtual void Connect(TlsClient tlsClient) { if (tlsClient == null) throw new ArgumentNullException("tlsClient"); if (this.mTlsClient != null) throw new InvalidOperationException("'Connect' can only be called once"); this.mTlsClient = tlsClient; this.mSecurityParameters = new SecurityParameters(); this.mSecurityParameters.entity = ConnectionEnd.client; this.mTlsClientContext = new TlsClientContextImpl(mSecureRandom, mSecurityParameters); this.mSecurityParameters.clientRandom = CreateRandomBlock(tlsClient.ShouldUseGmtUnixTime(), mTlsClientContext.NonceRandomGenerator); this.mTlsClient.Init(mTlsClientContext); this.mRecordStream.Init(mTlsClientContext); TlsSession sessionToResume = tlsClient.GetSessionToResume(); if (sessionToResume != null && sessionToResume.IsResumable) { SessionParameters sessionParameters = sessionToResume.ExportSessionParameters(); if (sessionParameters != null) { this.mTlsSession = sessionToResume; this.mSessionParameters = sessionParameters; } } SendClientHelloMessage(); this.mConnectionState = CS_CLIENT_HELLO; CompleteHandshake(); }