I need to create keystore and truststore with root signed certificates.
I have these files (at this step they are identical for client and for server):
client_password lets say 12345
I will create the truststore with the client certificate. Now I need to create keystore. I tried this:
openssl pkcs12 -export -inkey root_cert.pem -in client_cert.pem -out client.p12
This result in an error: "
unable to load private key".
Next command, after creating the
.p12 file is (when openssl command will end successfully):
keytool -importkeystore -srckeystore client.p12 -srcstoretype pkcs12 -destkeystore client.jks -deststoretype jks
What should be the command in order to create keystore with root-signed certificates? How should I build the
.p12 file with the root signed certificate?
Also, for mutual authentication in Java truststore is required. After trying some options the correct way to build the truststore is: (12345 is client_password which I used in all places where password was required)
keytool -importcert -trustcacerts -keystore client_truststore.jks -storetype jks -storepass 12345 -file root_cert.pem
Where 12345 is client_password (which I used in all places where password was required)