Uncategorized

Java Keystore – Chaining

A good reference site for how best to create the correct chain length in a jks :-

http://stackoverflow.com/questions/16062072/how-to-add-certificate-chain-to-keystore

Essentially, cat all pem files into one pem file

cat cert.pem chain.pem fullchain.pem >all.pem

Then create a p12 file, this can then be used to import into a keystore, then the chaining count should be correct

openssl pkcs12 -export -in all.pem -inkey privkey.pem -out cert_and_key.p12 -name tomcat -CAfile chain.pem -caname root -password MYPASSWORD

Keytool command to import p12 file

keytool -importkeystore -deststorepass MYPASSWORD -destkeypass MYPASSWORD -destkeystore MyDSKeyStore.jks -srckeystore cert_and_key.p12 -srcstoretype PKCS12 -srcstorepass MYPASSWORD -alias tomcat

keytool -import -trustcacerts -alias root -file chain.pem -keystore MyDSKeyStore.jks -storepass MYPASSWORD

Leave a Reply

Your email address will not be published. Required fields are marked *