简体   繁体   English

从 pem 文件生成 JKS 密钥库

[英]Generate JKS keystore from pem files

I have a bunch of .pem files viz cert,chain,fullchain,privkey and I have to generate a jks keystore from it, so that I can attach it to a web call to fetch data from a secured endpoint.我有一堆.pem文件,即cert、chain、fullchain、privkey ,我必须从中生成一个jks密钥库,以便我可以将其附加到 web 调用以从安全端点获取数据。 Can i add/ do i need to add all the certs to a single jks?我可以添加/我需要将所有证书添加到单个 jks 吗?

I found this technique but not sure whether i should be adding all certs into a single keystore?我发现了这种技术,但不确定是否应该将所有证书添加到单个密钥库中? : - https://docs.oracle.com/cd/E35976_01/server.740/es_admin/src/tadm_ssl_convert_pem_to_jks.html : - https://docs.oracle.com/cd/E35976_01/server.740/es_admin/src/tadm_ssl_convert_pem_to_jks.7FC365FDC70D822C9A235FDC3AFC22

What I do for my case and works 100%:我为我的案例所做的工作和 100% 的工作:

  1. Generate a keystore with this command:使用以下命令生成密钥库:

keytool -genkey -alias youralias -keyalg RSA -keystore keystore.jks keytool -genkey -alias youralias -keyalg RSA -keystore keystore.jks

  1. Import Certificate进口证书

keytool -importcert -file yourcertificate.cer -keystore keystore.jks -alias "Alias" keytool -importcert -file yourcertificate.cer -keystore keystore.jks -alias "别名"

  1. Download KeyStore Explorer and drop your keystore there.下载 KeyStore Explorer 并将您的密钥库放在那里。 Enter with your password.输入您的密码。 Right click on keystore and Import "from file".右键单击密钥库并“从文件”导入。 You can find a lot of options there and you can add as many certs you want.您可以在那里找到很多选项,并且可以添加任意数量的证书。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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