ChainValidationHelper(SslStream owner, MobileTlsProvider provider, MonoTlsSettings settings, bool cloneSettings, MonoTlsStream stream) { if (settings == null) { settings = MonoTlsSettings.CopyDefaultSettings(); } if (cloneSettings) { settings = settings.CloneWithValidator(this); } if (provider == null) { provider = MonoTlsProviderFactory.GetProviderInternal(); } this.provider = provider; this.settings = settings; this.tlsStream = stream; if (owner != null) { this.owner = new WeakReference <SslStream> (owner); } var fallbackToSPM = false; if (settings != null) { certValidationCallback = GetValidationCallback(settings); certSelectionCallback = Private.CallbackHelpers.MonoToInternal(settings.ClientCertificateSelectionCallback); fallbackToSPM = settings.UseServicePointManagerCallback ?? stream != null; } if (stream != null) { this.request = stream.Request; if (certValidationCallback == null) { certValidationCallback = request.ServerCertValidationCallback; } if (certSelectionCallback == null) { certSelectionCallback = new LocalCertSelectionCallback(DefaultSelectionCallback); } if (settings == null) { fallbackToSPM = true; } } if (fallbackToSPM && certValidationCallback == null) { certValidationCallback = ServicePointManager.ServerCertValidationCallback; } }
public MonoTlsStream(HttpWebRequest request, NetworkStream networkStream) { this.request = request; this.networkStream = networkStream; settings = request.TlsSettings; provider = request.TlsProvider ?? MonoTlsProviderFactory.GetProviderInternal(); status = WebExceptionStatus.SecureChannelFailure; /*validationHelper =*/ ChainValidationHelper.Create(provider.Provider, ref settings, this); }
internal static ICertificateValidator GetDefaultValidator(MonoTlsSettings settings) { var provider = MonoTlsProviderFactory.GetProviderInternal(); if (settings == null) { return(new ChainValidationHelper(null, provider, null, false, null)); } if (settings.CertificateValidator != null) { throw new NotSupportedException(); } return(new ChainValidationHelper(null, provider, settings, false, null)); }
public MonoTlsStream(HttpWebRequest request, NetworkStream networkStream) { #if SECURITY_DEP this.request = request; this.networkStream = networkStream; settings = request.TlsSettings; provider = request.TlsProvider ?? MonoTlsProviderFactory.GetProviderInternal(); status = WebExceptionStatus.SecureChannelFailure; ChainValidationHelper.Create(provider, ref settings, this); #else throw new PlatformNotSupportedException(EXCEPTION_MESSAGE); #endif }