public LdapServer() { m_conn = null; m_cert = null; Timeout = Settings.Store.LdapTimeout; int encMethod = Settings.Store.EncryptionMethod; m_encryptionMethod = (Settings.EncryptionMethod)Enum.ToObject(typeof(Settings.EncryptionMethod), encMethod); m_verifyCert = Settings.Store.RequireCert; string certFile = Settings.Store.ServerCertFile; if ((m_encryptionMethod == Settings.EncryptionMethod.START_TLS || m_encryptionMethod == Settings.EncryptionMethod.TLS_SSL) && m_verifyCert) { m_logger.DebugFormat("Loading server certificate: {0}", certFile); if (!string.IsNullOrEmpty(certFile) && File.Exists(certFile)) { m_cert = new X509Certificate2(certFile); } else { m_logger.DebugFormat("Certificate file not provided or not found, will validate against Windows store.", certFile); } } string[] hosts = Settings.Store.LdapHost; int port = Settings.Store.LdapPort; m_serverIdentifier = new LdapDirectoryIdentifier(hosts, port, false, false); m_logger.DebugFormat("Initializing LdapServer host(s): [{0}], port: {1}, encryption = {2}, verifyCert = {3}", string.Join(", ", hosts), port, m_encryptionMethod.ToString(), m_verifyCert); this.Connect(); }
public LdapServer() { m_conn = null; m_cert = null; Timeout = Settings.Store.LdapTimeout; int encMethod = Settings.Store.EncryptionMethod; m_encryptionMethod = (Settings.EncryptionMethod)Enum.ToObject(typeof(Settings.EncryptionMethod), encMethod); m_verifyCert = Settings.Store.RequireCert; string certFile = Settings.Store.ServerCertFile; if ((m_encryptionMethod == Settings.EncryptionMethod.START_TLS || m_encryptionMethod == Settings.EncryptionMethod.TLS_SSL) && m_verifyCert) { m_logger.DebugFormat("Loading server certificate: {0}", certFile); if ( !string.IsNullOrEmpty(certFile) && File.Exists(certFile)) { m_cert = new X509Certificate2(certFile); } else m_logger.DebugFormat("Certificate file not provided or not found, will validate against Windows store.", certFile); } string[] hosts = Settings.Store.LdapHost; int port = Settings.Store.LdapPort; m_serverIdentifier = new LdapDirectoryIdentifier(hosts, port, false, false); m_logger.DebugFormat("Initializing LdapServer host(s): [{0}], port: {1}, encryption = {2}, verifyCert = {3}", string.Join(", ", hosts), port, m_encryptionMethod.ToString(), m_verifyCert); this.Connect(); }