How to create a PKCS12 file with intermediate certificates?

I successfully managed to create a PKCS12 file with the following command:

openssl pkcs12 -export -in foo.crt -inkey bar.key -out out.p12

However SSLChecker (https://decoder.link/sslchecker) shows that the chain doesn't contain any intermediate certificates. I got an ca-bundle file from my SSL provider. Is there anyway to convert this file to the PKCS12 format?

I need this for a ssl secured spring boot server. So maybe a JKS file would work aswell?

Thanks in advance!

Upvotes: 2

Views: 3615

Answers (1)

not2savvy
not2savvy

Reputation: 4321

You can use the -certfile option to include an additional certificate in the output. For example:

openssl pkcs12 -export \
               -in foo.crt \
               -inkey bar.key \
               -certfile intermediate.crt
               -out out.p12

Of course, intermediate.crt can hold multiple certificates, if needed.

Check with

openssl pkcs12 -nokeys -info -in out.p12

Upvotes: 0

Related Questions