简体   繁体   中英

How to combine cer and key to generate jks file

I am new to certificates and its conversions from one form to other. I also tried exploring but finding it a bit difficult to interpret exact info. I got two files gtcloud.cer (certificate) and gtcloud.key (private key starts with BEGIN_PRIVATE_KEY , ends with END_PRIVATE_KEY ).

Now I want to merge these two to generate a single JKS file which I can use in my java application.

Is there any GUI based software or we have to use openssl for this?

This site explains it. I was able to use it successfully.

Summary: Use the following two commands.

openssl pkcs12 -export -in [path to certificate] -inkey [path to private key] -certfile [path to certificate ] -out testkeystore.p12
keytool -importkeystore -srckeystore testkeystore.p12 -srcstoretype pkcs12 -destkeystore wso2carbon.jks -deststoretype JKS

Update : If you need to convert you certificate to the pem format, use the following command:

openssl x509 -inform der -in [path to certificate ] -out myCert.pem

Also, here are some good information about the existing formats: Certificate standards

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM