I have a file with a certificate chain - certificate.cer:
subject=/C... issuer=/C=US/O=VeriSign, Inc... -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- subject=/C=US/O=VeriSign, Inc... issuer=/C=US/O=VeriSign, Inc... -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- subject=/C=US/O=VeriSign, Inc... issuer=/C=US/O=VeriSign, Inc... -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----
I need to add this certificate chain to the keystore.
What am I doing:
openssl x509 -outform der -in certificate.cer -out cert.der keytool -v -importcert -alias mykey -file cert.der -keypass <passwd> -keystore keystore -storepass <passwd> -alias <myalias>
As a result, I have only 1 certificate in the keystore.
But must have 3.
What could be wrong?
DECISION:
CA sent me certificates in PKCS # 7 format.
I saved them in the certificate.p7b file, and then successfully added them to the keystore by running the following command:
keytool -import -trustcacerts -file certificate.p7b -keystore keystore -storepass <mypasswd> -alias "myalias"
Volodymyr bezuglyy
source share