title: LDAP Queries are very slow on SSL (Java - SpringFramework)
body: <p>We have a web application in Java (Spring Framework). For authentication and user management, we are using SSO with LDAP.</p>
  
  <p>The LDAP context is as defined in the bean below:</p>
  
  <pre><code>&lt;bean id="legacyLdapContext" class="org.springframework.ldap.core.support.LdapContextSource"&gt;
     &lt;property name="url" value="ldaps://aaa.bbb.ccc.edu:636"/&gt;
      &lt;property name="base" value="cn=Users,dc=bbb,dc=ccc,dc=edu"/&gt;
      &lt;property name="userDn" value="user"/&gt;
      &lt;property name="password" value="*****"/&gt;
      &lt;property name="pooled" value="true"/&gt;
      &lt;property name="baseEnvironmentProperties"&gt;
          &lt;map&gt;
              &lt;entry&gt;
                  &lt;key&gt;
                      &lt;value&gt;java.naming.security.authentication&lt;/value&gt;
                  &lt;/key&gt;
                  &lt;value&gt;simple&lt;/value&gt;
              &lt;/entry&gt;
              &lt;entry key="java.naming.referral"&gt;
                  &lt;value&gt;ignore&lt;/value&gt;
              &lt;/entry&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Everything works fine, but the connection/queries are very slow.
  If the same configuration is changed to non ssl (`ldap://aaa.bbb.ccc.edu:389') it is lightening fast. A query that takes the non SSL context just a few seconds, takes the SSL context 7 minutes.</p>
  
  <p>Is there any LDAPS related configuration missing? I have installed the certificate to JVM using the steps here <a href="http://javacolors.blogspot.in/2012/05/how-to-register-ssl-certificates-in.html" rel="nofollow">http://javacolors.blogspot.in/2012/05/how-to-register-ssl-certificates-in.html</a> .</p>