Hello,

I'm trying to create an embedded LdapServer for testing purposes.

I managed to launch a server which can be accessed in plain and TLS mode with the code below.

        public void startServer() throws Exception {
            server = new LdapServer();
            int serverPort = 10390;
            TcpTransport transports = new TcpTransport(serverPort);
            // transports.setEnableSSL(true);

            server.setTransports(transports);
            server.setDirectoryService(service);
            server.setKeystoreFile("C:/path/to/server.ks");
            server.setCertificatePassword("secret");
            StartTlsHandler handler = new StartTlsHandler();
            server.addExtendedOperationHandler(handler);

            server.start();
            System.out.println("Server started");
        }

My problem is that my keystore does not seem to be taken into account.
When I connect with TLS on Apache Directory Studio I can display the received certificate and it looks like an apache one.

How could I set my own keystore ?
And is there a way to have a server with both LDAPS and TLS enabled ?

Cheers,
Stephane.

Reply via email to