ananasbananashakar
Aug 10th, 2007, 04:35 AM
Hi there
I've got some problems setting up my LDAPS connection with External Authentication to my Active Directory. Because I have to do some password operations I have to use LDAPS and can't fallback to LDAP.
I have got installed the public CA certificate in my truststore, imported my client certificate in the keystore, but still got the following HandshakeException:
Unable to communicate with LDAP server; nested exception is javax.naming.CommunicationException: simple bind failed: ttsrv01:636 [Root exception is javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificate contains unsupported critical extensions: [2.5.29.17]] :mad:
It seems that in my client certificate the SubjectAltName extension (2.5.29.17) is viewed as critical, but it shouldn't. If i view my certificate with the windows mmc certificate snap-in, it is not marked as critical!
How can I avoid that failure. It is obvious that this handshake should establish at all, because this field is NOT critical. Has someone got this error too and knows how to do a workaround?
I've been looking around for two days now and I don't know much more than before I started.
For my SSL setup, I have extended LdapContextSource:
package com.usp.portal.portlets.usermgmt.dao.ldap;
import java.util.Hashtable;
import javax.naming.Context;
import org.springframework.ldap.support.LdapContextSource ;
public class SecureLdapContextSource
extends LdapContextSource {
private String keyStore = null;
private String keyStorePassword = null;
private String trustStore = null;
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
Hashtable env = super.getAuthenticatedEnv();
//simple authentication needs username and password, external needs a keystore
env.put(Context.SECURITY_AUTHENTICATION, "External");
//env.put(Context.SECURITY_AUTHENTICATION, "simple");
//env.put(Context.SECURITY_PRINCIPAL, super.userName);
//env.put(Context.SECURITY_CREDENTIALS, super.password);
//specify use of ssl
env.put(Context.SECURITY_PROTOCOL, "ssl");
//set the environment
super.setupAuthenticatedEnvironment(env);
System.setProperty("javax.net.ssl.trustStore", trustStore);
System.setProperty("javax.net.ssl.keyStore", keyStore);
System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
}
public void setKeyStore(String keyStore) {
this.keyStore = keyStore;
}
public void setTrustStore(String trustStore) {
this.trustStore = trustStore;
}
public void setKeyStorePassword(String password) {
this.keyStorePassword = password;
}
}
I've got some problems setting up my LDAPS connection with External Authentication to my Active Directory. Because I have to do some password operations I have to use LDAPS and can't fallback to LDAP.
I have got installed the public CA certificate in my truststore, imported my client certificate in the keystore, but still got the following HandshakeException:
Unable to communicate with LDAP server; nested exception is javax.naming.CommunicationException: simple bind failed: ttsrv01:636 [Root exception is javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificate contains unsupported critical extensions: [2.5.29.17]] :mad:
It seems that in my client certificate the SubjectAltName extension (2.5.29.17) is viewed as critical, but it shouldn't. If i view my certificate with the windows mmc certificate snap-in, it is not marked as critical!
How can I avoid that failure. It is obvious that this handshake should establish at all, because this field is NOT critical. Has someone got this error too and knows how to do a workaround?
I've been looking around for two days now and I don't know much more than before I started.
For my SSL setup, I have extended LdapContextSource:
package com.usp.portal.portlets.usermgmt.dao.ldap;
import java.util.Hashtable;
import javax.naming.Context;
import org.springframework.ldap.support.LdapContextSource ;
public class SecureLdapContextSource
extends LdapContextSource {
private String keyStore = null;
private String keyStorePassword = null;
private String trustStore = null;
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
Hashtable env = super.getAuthenticatedEnv();
//simple authentication needs username and password, external needs a keystore
env.put(Context.SECURITY_AUTHENTICATION, "External");
//env.put(Context.SECURITY_AUTHENTICATION, "simple");
//env.put(Context.SECURITY_PRINCIPAL, super.userName);
//env.put(Context.SECURITY_CREDENTIALS, super.password);
//specify use of ssl
env.put(Context.SECURITY_PROTOCOL, "ssl");
//set the environment
super.setupAuthenticatedEnvironment(env);
System.setProperty("javax.net.ssl.trustStore", trustStore);
System.setProperty("javax.net.ssl.keyStore", keyStore);
System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
}
public void setKeyStore(String keyStore) {
this.keyStore = keyStore;
}
public void setTrustStore(String trustStore) {
this.trustStore = trustStore;
}
public void setKeyStorePassword(String password) {
this.keyStorePassword = password;
}
}