/// <summary> /// Starts SSL/TLS on a connection. This can be used for old Jabber style SSL. /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> private async Task DoSslAsync(CancellationToken cancellationToken) { await Task.Run(async() => { var tlsHandler = await TlsHandlerProvider.ProvideAsync(this); XmppSessionState.Value = SessionState.Securing; Pipeline.AddFirst(tlsHandler); XmppSessionState.Value = SessionState.Secure; }, cancellationToken); }
/// <summary> /// Handle StartTls asynchronous /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> private async Task <StreamFeatures> DoStartTlsAsync(CancellationToken cancellationToken) { XmppSessionState.Value = SessionState.Securing; var tlsHandler = await TlsHandlerProvider.ProvideAsync(this); await SendAsync <Proceed>(new StartTls(), cancellationToken); Pipeline.AddFirst(tlsHandler); var streamFeatures = await ResetStreamAsync(cancellationToken); XmppSessionState.Value = SessionState.Secure; return(streamFeatures); }