COnfiguration for client to server secure communication via SSL
コード例 #1
0
        protected internal virtual SSLConfig ParseSSLConfig(XmlNode node)
        {
            var sslConfig   = new SSLConfig();
            var atts        = node.Attributes;
            var enabledNode = atts.GetNamedItem("enabled");
            var enabled     = enabledNode != null && CheckTrue(GetTextContent(enabledNode).Trim());

            sslConfig.SetEnabled(enabled);
            foreach (XmlNode n in node.ChildNodes)
            {
                var nodeName = CleanNodeName(n.Name);
                if ("properties".Equals(nodeName))
                {
                    FillProperties(n, sslConfig.GetProperties());
                }
            }
            return(sslConfig);
        }
コード例 #2
0
        private static void HandleSSLConfig(this SSLConfig sslConfig, XmlNode node)
        {
            var enabledNode = node?.Attributes?.GetNamedItem("enabled");

            sslConfig.Enabled = enabledNode != null && CheckTrue(GetTextContent(enabledNode).Trim());
            foreach (XmlNode n in node.ChildNodes)
            {
                var nodeName = CleanNodeName(n.Name);
                if ("properties".Equals(nodeName))
                {
                    var props = new Dictionary <string, string>();
                    props.FillProperties(n);
                    if (props.TryGetValue(HazelcastProperties.CertificateName, out var certificateName))
                    {
                        sslConfig.CertificateName = certificateName;
                    }
                    if (props.TryGetValue(HazelcastProperties.ValidateCertificateChain, out var validateCertificateChain))
                    {
                        sslConfig.ValidateCertificateChain = Convert.ToBoolean(validateCertificateChain);
                    }
                    if (props.TryGetValue(HazelcastProperties.ValidateCertificateName, out var validateCertificateName))
                    {
                        sslConfig.ValidateCertificateName = Convert.ToBoolean(validateCertificateName);
                    }
                    if (props.TryGetValue(HazelcastProperties.CheckCertificateRevocation, out var checkCertificateRevocation))
                    {
                        sslConfig.CheckCertificateRevocation = Convert.ToBoolean(checkCertificateRevocation);
                    }
                    if (props.TryGetValue(HazelcastProperties.CertificateFilePath, out var certificateFilePath))
                    {
                        sslConfig.CertificateFilePath = certificateFilePath;
                    }
                    if (props.TryGetValue(HazelcastProperties.CertificatePassword, out var certificatePassword))
                    {
                        sslConfig.CertificatePassword = certificatePassword;
                    }
                    if (props.TryGetValue(HazelcastProperties.SslProtocol, out var sslProtocol))
                    {
                        sslConfig.SslProtocol = (SslProtocols)Enum.Parse(typeof(SslProtocols), sslProtocol, true);
                    }
                }
            }
        }
コード例 #3
0
 protected internal virtual SSLConfig ParseSSLConfig(XmlNode node)
 {
     var sslConfig = new SSLConfig();
     var atts = node.Attributes;
     var enabledNode = atts.GetNamedItem("enabled");
     var enabled = enabledNode != null && CheckTrue(GetTextContent(enabledNode).Trim());
     sslConfig.SetEnabled(enabled);
     foreach (XmlNode n in node.ChildNodes)
     {
         var nodeName = CleanNodeName(n.Name);
         if ("properties".Equals(nodeName))
         {
             FillProperties(n, sslConfig.GetProperties());
         }
     }
     return sslConfig;
 }
コード例 #4
0
 /// <summary>
 /// Sets <see cref="SSLConfig"/>
 /// </summary>
 /// <param name="sslConfig"><see cref="SSLConfig"/></param>
 /// <returns><see cref="ClientNetworkConfig"/> for chaining</returns>
 public virtual ClientNetworkConfig SetSSLConfig(SSLConfig sslConfig)
 {
     _sslConfig = sslConfig;
     return(this);
 }
コード例 #5
0
 public virtual ClientNetworkConfig SetSSLConfig(SSLConfig sslConfig)
 {
     _sslConfig = sslConfig;
     return this;
 }