如何结合cer和key生成jks文件 [英] How to combine cer and key to generate jks file

查看:178
本文介绍了如何结合cer和key生成jks文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不熟悉证书及其从一种形式到另一种形式的转换.我也尝试探索,但发现解释确切信息有点困难.我有两个文件 gtcloud.cer(证书)和 gtcloud.key(私钥以 BEGIN_PRIVATE_KEY 开头,以 END_PRIVATE_KEY 结尾代码>).

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).

现在我想合并这两个文件以生成一个可以在我的 java 应用程序中使用的 JKS 文件.

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

是否有任何基于 GUI 的软件,或者我们必须为此使用 openssl?

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.

总结:使用以下两个命令.

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

更新:如果您需要将证书转换为 pem 格式,请使用以下命令:

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

这篇关于如何结合cer和key生成jks文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆