如何从 Java 密钥库创建 PFX 文件?
我有一个包含单个证书的 Java 密钥库(.jks 文件)。 如何从此密钥库创建 .pfx 文件?
I have a Java keystore (.jks file) holding a single certificate. How can I create a .pfx file from this keystore?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从 Java 6 开始,
keytool
有一个-importkeystore
选项,它应该能够将 JKS 存储转换为 PKCS#12 存储 (.p12/.pfx):会要求您输入源文件和目标文件(jks、pfx)的密码
From Java 6 onwards,
keytool
has an-importkeystore
option, which should be able to convert a JKS store into a PKCS#12 store (.p12/.pfx):It will ask you to enter a password for source and destination (jks, pfx) files
这个家伙()似乎写了一个小Java类和批处理文件,并提供了很好的说明,可以在这里执行此操作:http://www.crionics.com/products/opensource/faq/signFree.htm#DownloadTools
如果您想自己动手,.bat 文件中的关键行似乎是使用
ExportPrvKey 执行从密钥库中提取私钥的步骤。
This guy() seems to have written a little Java class and batch file with good instructions to do this here: http://www.crionics.com/products/opensource/faq/signFree.htm#DownloadTools
If you want to do it yourself the key lines in the .bat file seem to be uses
where ExportPrvKey does the step of extracting the private key from the keystore.
keytool -importkeystore -srckeystore [MY_KEYSTORE.jks] -destkeystore [MY_FILE.p12] -srcstoretype JKS -deststoretype PKCS12
然后它会请求您的密码和 BAM - 很好,昨晚刚刚尝试过,效果很好。
您可能必须首先将目录更改为 java jdk 或 jre bin 文件夹,然后包含当前密钥库和 dest .p12 文件的完整路径。
keytool -importkeystore -srckeystore [MY_KEYSTORE.jks] -destkeystore [MY_FILE.p12] -srcstoretype JKS -deststoretype PKCS12
Then it will request your passphrases and BAM - good to go, tried just last night worked great.
you may have to change dir to your java jdk, or jre bin folder first, then include a full path to your current Keystore, and dest .p12 file.
您可以使用以下命令导出包含私钥的 PFX 文件:
You can export a PFX file including private key, with the following command: