I'm using JSSE api's to write a SSL client application.

Berin Loritsch

You have to extend the code for com.sun.net.ssl.X509KeyManager (or in JDK 1.4, javax.net.ssl.X509KeyManager). There is a method that lets you choose the alias to use when authenticating.

You can then use your X509KeyManager by initializing the context with code like this:

            KeyManager[] managers = managerFactory.getKeyManagers();

            for (int i = 0; i < managers.length; i++) {
                if (managers[i] instanceof X509KeyManager) {
                    X509KeyManager manager = (X509KeyManager) managers[i];
                    managers[i] = new WrappedX509KeyManager(manager, keys, this.defaultpw);

            context.init(managers, null, this.rand);