I'm interfacing with a secure web service, and authenticating using a client certificate. I'm confused about step #3 in the client configuration:

  1. Generate a private key into keystore
  2. Generate a CSR to have your public key signed
  3. Import the Certificate Authority certificate into your keystore so that a proper certificate chain can be established when you import your signed certificate in Step 4.
  4. Import the certificate provided in response to the CSR

Steps 1, 2, and 4 all make sense. Step 3 makes no sense to me. I already have my private key in the keystore, and the certificate is a statement that xyz third party has signed my keypair. If I skip step three, I get an error: "keytool error: java.lang.Exception: Failed to establish chain from reply". I don't understand what it is validating / why such a validation is necessary. Hypothetically, if I happened to import a CSR response from someone I didn't trust, it doesn't seem like that grants any privileges / does any damage.

The certificate imported in step #3 is NOT related to the certificate chain used to validate the server's identity when the client connects (that certificate is separately imported into my truststore). The certificate in step #3 is required in order to import the response to my CSR.

Why is step 3 necessary?

1 Answer 1


In SSL, when the client sends its certificate, it actually sends a certificate chain, from root down to the client's certificate (the root itself needs not be sent, but intermediate CA shall be sent; see the standard there and there). To rebuild such a chain, your software apparently needs you to import the CA certificate in the keystore.

Also, to some extent, validating the certificate received from the CA makes sure that the certificate was not altered during its transit. Nominally, your certificate is not for you; it is something you show to other people (or machine) and they validate it; but you prefer it when you can check that you have a "good certificate" to show.

  • Just a detail, shouldn't the chain be the other way around, from EEC to root, when it's sent? ("Each following certificate MUST directly certify the one preceding it.")
    – Bruno
    Commented Mar 19, 2013 at 19:41
  • The standard X.509 nomenclature is that the chain starts with the trust anchor (the root) and ends with the EE certificate. In the SSL Certificate messages, chains are sent in reverse order. I usually follow the standard nomenclature when explaining, and I consider the actual order "on the wire" to be an encoding convention. Commented Mar 19, 2013 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .