Rodrigo Zurek
Rodrigo Zurek

Reputation: 4575

Transform .crt and .pem files to keystore

I received a .crt file and a .pem file from my registrar but I need to transform it into a keystore(JKS) to be able to use it on my server.

How do I transform the files?

Upvotes: 1

Views: 4930

Answers (1)

always_a_rookie
always_a_rookie

Reputation: 4840

You do not transform the .crt or .pem files to a KeyStore, you have to add them to a KeyStore.

You can add them using keytool by running this command:

keytool -importcert -keystore <KEYSTORE.JKS> -storepass <KEYSTORE_PASSWORD> -file <YOUR_CERT_OR_PEM_FILE> -alias <ALIAS_NAME>

This will create a KeyStore if it doesn't exist at that location and then add the certificate into it or if the KeyStore exists, it just adds the certificate to it.

You can then view if the certificate is actually added by running this command:

keytool -list -keystore <YOUR_KEYSTORE> -storepass <KEYSTORE_PASSWORD> -alias <ALIAS_NAME> -v

Upvotes: 3

Related Questions