Multiple Certificate import issue
My application needs to talk to more than one secure servers.
I am using keytool to import the certificate.
Certificate import steps:
keytool -import -keystore aaa.jks -file aaa.co.uk.cer
keytool -import -keystore bbb.jks -file bbb.co.uk.cer
It works fine with one certificate but as soon as I import the second certificate the previous one stops working.
Error:
Exception:javax.naming.CommunicationException:
simple bind failed: aaa.co.uk:636
[Root exception is javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I also tr开发者_运维问答ied the following steps but it's still failing:
keytool -import -keystore aaa.jks -alias ms -file aaa.co.uk.cer
keytool -import -alias ms -file bbb.co.uk.cer
I think I should be appending the certificates in one keystore but don't know how to do it.
Any idea how to do it or am I missing something?
Env: Java 1.6
App Server: GlassfishThanks to @BertNase for suggestion.
The following import command has fixed the issue:
keytool -import -keystore myStore.jks -alias aliasA -file aaa.co.uk.cer
keytool -import -keystore myStore.jks -alias aliasB -file bbb.co.uk.cer
Now, this command imports both certificates in the same keystore.
Perhaps you import both certificates to the same alias ?
tell us the keytool command line you are using and what exactly 'stops working' after the second import.
精彩评论