Perhaps you could import the CA intermediate certificate into the keystore without associating it with the record in which you have the client certificate and its private key. You should see this using keytool -v -list -keystore store.jks . If you receive only one certificate for an alias record, they are not together.
You will need to import your certificate and its chain together into a key store alias that has your private key.
To find out which key alias the private key stores, use keytool -list -keystore store.jks (here I take the JKS store type here). This will tell you something like the following:
Your keystore contains 1 entry myalias, Feb 15, 2012, PrivateKeyEntry, Certificate fingerprint (MD5): xxxxxxxx
Here is the alias myalias . If you use -v in addition to this, you should see Alias Name: myalias .
If you do not have it separately, export the client certificate from the keystore:
keytool -exportcert -rfc -file clientcert.pem -keystore store.jks -alias myalias
This will give you the PEM file.
Using a text editor (or cat ), prepare a file (call bundle.pem ) with this client certificate and an intermediate CA certificate (and possibly the root CA certificate itself, if you want) so that the client certificate is at the beginning and its certificate the issuer is slightly lower.
It should look like this:
-----BEGIN CERTIFICATE----- MIICajCCAdOgAwIBAgIBAjANBgkqhkiG9w0BAQUFADA7MQswCQYDVQQGEwJVSzEa .... -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- MIICkjCCAfugAwIBAgIJAKm5bDEMxZd7MA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNV .... -----END CERTIFICATE-----
Now import this package back into the alias where your private key is located:
keytool -importcert -keystore store.jks -alias myalias -file bundle.pem
Bruno Feb 15 '12 at 20:21 2012-02-15 20:21
source share