You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bill Barrington <bi...@mindspring.com> on 2004/08/30 19:06:40 UTC

SSL Doesn't Work

I've tracked my SSL problem down to the following line of code in ./jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/jsse/JSSE14SocketFactory:

kmf.init(ks, keystorePass.toCharArray());  // kmf -> KeyManagerFactory, ks -> KeyStore

When invoked, this method throws an UnrecoverableKeyException which would tend to indicate that the password was incorrect. However, that is not the case.

I've reproduced the same error in a standalone program:

    public static void main(String[] args) throws Exception {

        KeyStore keyStore = KeyStore.getInstance("jks");
        FileInputStream fis = new FileInputStream("C:\\Documents and Settings\\Bbarrington\\.keystore");
        keyStore.load(fis, "changeit".toCharArray());
        fis.close();
        
        PrivateKey key = (PrivateKey) keyStore.getKey("tomcat", "changeit".toCharArray());
        System.out.println("key=" + key);  // key is printed out with no problems...
        
        
        KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
        try {
            kmf.init(keyStore, "changeit".toCharArray());
        } catch(UnrecoverableKeyException e) {
            System.err.println(e);
            return;
        }
        KeyManager[] km = kmf.getKeyManagers();
    }

There's nothing wrong with the keystore. I can load it and get the key.

So why can't the KeyManagerFactory be initialized?

This is driving me nuts!  Please help if you can!

Regards,

Bill Barrington




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org