将密钥和SSL证书导入java密钥库 [英] Import key and SSL Certificate into java keystore

查看:341
本文介绍了将密钥和SSL证书导入java密钥库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有pem格式的证书文件和私钥文件。是否可以使用Java代码将这些文件加载​​到Java密钥库中,使用JDK附带的默认库而不是第三方库。当我尝试使用Google搜索时,我只能找到.der格式的文件,可以使用java代码导入到java密钥库中。

I have certificate file and private key file in pem format. Is it possible to load these files into Java keystore using Java code with default libraries that comes with JDK and not with third party libraries. When I tried googling, I am able to find only files which are in .der format to import into java keystore using java code.

http://knowledge-oracle.blogspot.in/2009/02/import -private-key-and-certificate-in.html

是否可以通过java将带有pem格式的密钥和证书文件加载到java密钥库中代码没有转换为.der格式?

Is it possible to load key and certificate file which is in pem format into java keystore through java code without converting to .der format ?

推荐答案

有可能但不能不使用第三方库。

Java不对密钥库容器使用pem格式,因为OpenSSL会这样做,所以你必须将它们转换为密钥库 PKCS12 JKS

您可以使用bouncy castle通过代码进行转换,或者您可以使用工具从pem文件创建密钥库并在应用程序中使用密钥库。

试试这个java应用程序证书助手进行密钥库转换

It is possible but not without using third-party libraries.
Java does not use pem format for keystore containers as OpenSSL does so you will have to convert these into a keystore either PKCS12 or JKS.
You can do the conversion by code using bouncy castle or you could use a tool to create a keystore from the pem file and use the keystore in your application.
Try this java application Certificate Helper to do the conversion to keystore

这篇关于将密钥和SSL证书导入java密钥库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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