将.cer证书转换为.jks [英] Convert .cer certificate to .jks
问题描述
我需要将 .cer
文件转换为 .jks
文件。
我看到了一些关于它的问题,但没有看到我需要的解决方案。
I need to convert a .cer
file to a .jks
file.
I saw a few questions about it, but haven't seen a solution to what I need.
我不需要它来添加它到我的本地证书,但作为上传到服务器的文件。
我还需要只做一次,而不是以编程方式。
这个帖子有使用java将.cer转换为.jks 和作者说他已经成功完成了,但由于我没有足够的声誉,我无法对他的上一次回复发表评论,也不能向他发送个人信息并问他。
I don't need it in order to add it to my local certificates, but as a file to upload to a server. I also need to do it only once, and not programmatically. There's this thread Converting .cer to .jks using java and the author says he had done it successfully, but I couldn't comment to his last reply as I don't have enough reputation, nor could I send him a personal message and ask him.
所以,如果有人知道一个简单的方法,我会很高兴听到。
So if anyone knows of a simple way to do so, I'll be glad to hear.
推荐答案
JDK安装附带 keytool
(在 bin
文件夹中):
keytool
comes with the JDK installation (in the bin
folder):
keytool -importcert -file "your.cer" -keystore your.jks -alias "<anything>"
这将创建一个新的密钥库并仅向其添加证书。
This will create a new keystore and add just your certificate to it.
因此,您无法将证书转换为密钥库:您将证书添加到密钥库。
So, you can't convert a certificate to a keystore: you add a certificate to a keystore.
这篇关于将.cer证书转换为.jks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!