client authentication with Thawte Freemail certificates + JSSE

I'm trying to do SSL with Client Authentication. I'm using JSSE sample

code downloaded from this forum.

I think I have tracked my problem down to a mismatch in the Common

Names of my Certificate Authorities. In the CertificateRequest message,

the server is asking for any client certificates matching a CA's CN

of "Thawte Personal Freemail CA".

However, my free certificate is signed by "Personal Freemail RSA 2000.8.30".

So, the KeyManager doesn't find a matching certificate in my KeyStore,

and does not send it to the server. The end-result is a 403, as the server

has been configured with SSLClientAuth 2 (required).

To make matters worse, I have searched all over for a ""Personal Freemail RSA

2000.8.30" root certificate that I could install on the server, but have not found

it. Surely someone else must have hit this situation.... please suggest a

solution!

Below, is the relevant part of the trace.

Thank you!

*** CertificateRequest

Cert Types: RSA,

Cert Authorities:

<CN=selfsign.zigabyte.com, O=zigabyte, C=US>

<EMAILADDRESS=personal-freemail@thawte.com, CN=Thawte Personal Freemail CA, OU=C

ertification Services Division, O=Thawte Consulting, L=Cape Town, ST=Western Cap

e, C=ZA>

[read] MD5 and SHA1 hashes: len = 284

[ ... binary dump deleted ...]

*** ServerHelloDone

[read] MD5 and SHA1 hashes: len = 4

0000: 0E 00 00 00....

main, SEND SSL v3.0 ALERT: warning, description = no_certificate

main, WRITE: SSL v3.0 Alert, length = 2

[1656 byte] By [zigabyte] at [2007-9-27 3:24:07]
# 1

Finally got it working by overriding the default KeyManager.

Real problem is, the default KeyManager doesn't seem to know

about Certificate Chains. The "missing" certificate "Personal

Freemail RSA 2000.8.30" isn't missing at all.... it's right there

in the keystore, bundled together with my certificate.

The key to the solution was this other post:

http://forum.java.sun.com/thread.jsp?forum=2&thread=198871

I had to fill-in these two methods, not provided by the other poster:

public X509Certificate[] getCertificateChain(String certname) {

try {

// return the certificate chain from your keystore here

List certs = Arrays.asList(ks.getCertificateChain(certname));

X509Certificate[] x509 = new X509Certificate[certs.size()];

for(int i=0; i < certs.size(); ++i) {

x509 = (X509Certificate) certs.get(i);

System.out.println("Client Certificate Chain: " + x509.getSubjectDN());

}

return x509;

} catch (Exception e) {

e.printStackTrace(System.err);

return null;

}

}

public PrivateKey getPrivateKey(String alias) {

// return the private key from your keystore here

try {

return (PrivateKey) ks.getKey(alias, "changeit".toCharArray());

} catch (Exception e) {

e.printStackTrace(System.err);

return null;

}

}

zigabyte at 2007-7-5 1:15:09 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...