コード例 #1
0
ファイル: MobileTlsContext.cs プロジェクト: MoGoethe/mono
        protected MobileTlsContext(MobileAuthenticatedStream parent, MonoSslAuthenticationOptions options)
        {
            Parent           = parent;
            IsServer         = options.ServerMode;
            EnabledProtocols = options.EnabledSslProtocols;

            if (options.ServerMode)
            {
                LocalServerCertificate  = options.ServerCertificate;
                AskForClientCertificate = options.ClientCertificateRequired;
            }
            else
            {
                ClientCertificates = options.ClientCertificates;
                TargetHost         = options.TargetHost;
                ServerName         = options.TargetHost;
                if (!string.IsNullOrEmpty(ServerName))
                {
                    var pos = ServerName.IndexOf(':');
                    if (pos > 0)
                    {
                        ServerName = ServerName.Substring(0, pos);
                    }
                }
            }

            certificateValidator = CertificateValidationHelper.GetInternalValidator(
                parent.Settings, parent.Provider);
        }
コード例 #2
0
        public MobileTlsContext(
            MobileAuthenticatedStream parent, bool serverMode, string targetHost,
            SslProtocols enabledProtocols, X509Certificate serverCertificate,
            X509CertificateCollection clientCertificates, bool askForClientCert)
        {
            this.parent             = parent;
            this.serverMode         = serverMode;
            this.targetHost         = targetHost;
            this.enabledProtocols   = enabledProtocols;
            this.serverCertificate  = serverCertificate;
            this.clientCertificates = clientCertificates;
            this.askForClientCert   = askForClientCert;

            serverName = targetHost;
            if (!string.IsNullOrEmpty(serverName))
            {
                var pos = serverName.IndexOf(':');
                if (pos > 0)
                {
                    serverName = serverName.Substring(0, pos);
                }
            }

            certificateValidator = CertificateValidationHelper.GetInternalValidator(
                parent.Settings, parent.Provider);
        }
コード例 #3
0
        public MobileTlsContext(
            MobileAuthenticatedStream parent, bool serverMode, string targetHost,
            SslProtocols enabledProtocols, X509Certificate serverCertificate,
            X509CertificateCollection clientCertificates, bool askForClientCert)
        {
            this.parent             = parent;
            this.serverMode         = serverMode;
            this.targetHost         = targetHost;
            this.enabledProtocols   = enabledProtocols;
            this.serverCertificate  = serverCertificate;
            this.clientCertificates = clientCertificates;
            this.askForClientCert   = askForClientCert;

            certificateValidator = CertificateValidationHelper.GetInternalValidator(
                parent.Settings, parent.Provider);
        }