title: how to secure password during ldap connection
body: <p>I have developed an mvc application where I am using ldap authendication to validate the user.</p>
  
  <p>I need some help to secure my password during ldap connection. I have tried <code>Securesocketlayer=true</code> but I guess it need certificate. Its giving an error:</p>
  
  <blockquote>
    <p>handshake failure ssl.</p>
  </blockquote>
  
  <p>Here is my code. I am getting a comment from my security team User credentials are sent in clear text over the network for authentication.</p>
  
  <p>Can anyone help me on how to achieve this in ldap?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>using LdapConnection = Novell.Directory.Ldap.LdapConnection;
  using LdapException = Novell.Directory.Ldap.LdapException;
  
   var ldapHost = WebConfigurationManager.AppSettings["LDAP_HOST"];
   var ldapPort = WebConfigurationManager.AppSettings["LDAP_PORT"];
  
   var connection = new LdapConnection {SecureSocketLayer = true};
   connection.Connect(ldapHost, Convert.ToInt32(ldapPort)); 
  
   sb = new StringBuilder();
   sb.Append(ldapLocation).Append(userName).Append(",").Append(ldapLocationIndia);
   connection.Bind(LdapConnection.Ldap_V3, sb.ToString(), password);  
  </code></pre>
  
  <p>Thanks in advance</p>