Alex Karasulu <akaras...@...> writes:
>
> http://cwiki.apache.org/DIRxSRVx11/33-how-to-enable-ssl.html
>
> On Wed, Feb 3, 2010 at 12:42 AM, Kiss László - Károly <pityq1 <at>
yahoo.com>wrote:
>
> > Hi,
> >
> > I needed an ldap server which can be started and configred from java so I
> > choose apacheds 1.5. As a new requirement I need to connect to it via a
> > secure connection so I try to figure it out how to do it. I found the
> > setEnableLdaps(true); method on the ldap service but I could not find any
> > way to specify to the server the keystore file.
> > Could anyone help me please?
> > Thanks,
> > Laszlo
> >
> >
> >
>
Thanks. There is a description how you define the certificate path in the
server.xml but I'm starting the server from java so I don't have the xml file.
I
was wondering if there is a way to define the way from java.
Also another question. I read that apacheds supports TLS but when I try connect
with the client I got the following exception:
javax.naming.CommunicationException: [LDAP: error code 2 - Unrecognized
extended
operation EXTENSION_OID: 1.3.6.1.4.1.1466.20037]; remaining name ''
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3089)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2987)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2794)
at com.sun.jndi.ldap.LdapCtx.extendedOperation(LdapCtx.java:3166)
at
javax.naming.ldap.InitialLdapContext.extendedOperation(InitialLdapContext.java:1
64)
at client.TlsLdapClinet.connectTotServer(TlsLdapClinet.java:61)
at client.TlsLdapClinet.main(TlsLdapClinet.java:35)
My client looks like:
private InitialDirContext connectTotServer() throws NamingException,
IOException{
final String url = "ldaps://localhost:10389";
InitialLdapContext context = new InitialLdapContext(new Hashtable() {{
put(INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
put(PROVIDER_URL, url);
}}, null);
StartTlsResponse tlsResponse = (StartTlsResponse)context.
extendedOperation(new StartTlsRequest());
tlsResponse.negotiate();
return context;
}
If I try with simple ldaps connection it works but this version doesn't.
Thanks in advance for your help,
Laszlo