I have multiple client certificates (.pem
s without shared ca root), that I would like to convert to a single pkcs12 truststore without password for testing purposes.
The truststore should not contain any private keys as it is for validating the clients only.
I tried the following:
cat client1.crt client2.crt > trusted-clients-collection
openssl pkcs12 -export -in trusted-clients-collection -nokeys -passout 'pass:' -out trusted-clients.p12
But that returned an empty truststore. Replacing -in
with -certfile
doesn't help either. If I omit -nokeys
, then a private key is requested. If I provide that, then the private key will be in the resulting truststore.
Or the following command
keytool -import -alias client1 -file client1.crt -keystore trusted-clients.p12 -storetype pkcs12 -storepass "changeit"
keytool -import -alias client2 -file client2.crt -keystore trusted-clients.p12 -storetype pkcs12 -storepass "changeit"
But that creates a truststore with a password and I couldn't find a way to use an empty password.
Is there a command to create a pkcs12 truststore from multiple pems without password? Hopefully using openssl. Or is my expectation that the pkcs12 file is a truststore off?
I'm using OpenSSL 1.1.1l as shipped by git (Bash) version 2.34.0.windows.1
Some test-certificates can be found here: https://github.com/yidongnan/grpc-spring-boot-starter/tree/master/tests/src/test/resources/certificates