Note:
- Prefer open-source PKCS12 format over Java-specific JKS format
- In Java, KeyStore and TrustStore both look same. The difference comes from the functionality
- The KeyStore holds the private key and certificates
- The TrustStore holds the public key/certificate of the of the Authenticator. e.g. to handshake with SSL-enabled Server, the client-side truststore holds the public key/certificate of the Server
- To download server's public SSL certificate:
openssl s_client -connect us-east-1-mykafka-cluster.technology:9092 > mykafka_server.crt
- To convert public certificate into DER format (prefer over PEM as PEM needs Private Key)
openssl x509 -outform der -in mykafka_server.crt -out mykafka_server.der
- To import the Server's public certificate in client-side truststore:
keytool -import -alias mykafka_cert -keystore mykafka_client_truststore.jks -file mykafka_server.der
chmod +x ./create_server_truststore.sh
./create_server_truststore.sh
cd server/ && ls -larth
chmod +x ./create_client_truststore.sh
./create_client_truststore.sh
cd client/ && ls -larth
chmod +x ./create_truststore_and_mutually_authenticate_server-client.sh
./create_truststore_and_mutually_authenticate_server-client.sh