//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 13/04/2018 Created [Fabian Sauter] /// </history> public ConnectionConfiguration() { this.tlsMode = TLSConnectionMode.FORCE; this.IGNORED_CERTIFICATE_ERRORS = new List <ChainValidationResult>(); this.disableStreamManagement = false; this.disableMessageCarbons = false; }
private async Task streamFeaturesMessageReceivedAsync(StreamFeaturesMessage features, NewValidMessageEventArgs args) { TLSStreamFeature tlsFeature = getTLSStreamFeature(features); TLSConnectionMode connectionMode = TCP_CONNECTION.account.connectionConfiguration.tlsMode; if (tlsFeature != null) { if (connectionMode == TLSConnectionMode.PROHIBIT) { if (tlsFeature.REQUIRED) { stopListeningForMessages(); string errorMsg = "TSL is required for server but TLS connection mode is set to prohibit!"; Logger.Error(errorMsg); setState(TLSState.ERROR); await XMPP_CONNECTION.onMessageProcessorFailedAsync(new ConnectionError(ConnectionErrorCode.TLS_CONNECTION_FAILED, errorMsg), true); } else { setState(TLSState.PROHIBITED); } return; } // Starting the TSL process: setMessageProcessed(args); setState(TLSState.CONNECTING); await XMPP_CONNECTION.sendAsync(new RequesStartTLSMessage(), false, true); setState(TLSState.REQUESTED); } else { if (connectionMode == TLSConnectionMode.FORCE) { stopListeningForMessages(); string errorMsg = "TSL is not available for this server but TLS connection mode is set to force!"; Logger.Error(errorMsg); setState(TLSState.ERROR); await XMPP_CONNECTION.onMessageProcessorFailedAsync(new ConnectionError(ConnectionErrorCode.TLS_CONNECTION_FAILED, errorMsg), true); return; } } }