简体   繁体   English

一个带有私钥和证书的 PEM 文件到 JKS

[英]one PEM file with private key and certificate into JKS

I have a JKS keystore in client application and I have been given one PEM file containing both private key and certificate to use for SOAP signature.我在客户端应用程序中有一个 JKS 密钥库,我得到了一个 PEM 文件,其中包含用于 SOAP 签名的私钥和证书。 PEM file looks like this: PEM 文件如下所示:

-----BEGIN RSA PRIVATE KEY-----
      ...
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
      ...
-----END CERTIFICATE-----

First question is how to import correctly this PEM to JKS?第一个问题是如何将此 PEM 正确导入 JKS?

Second question: given private key isn't password protected, it's possible to add a password to it before importing it to JKS keystore?第二个问题:鉴于私钥不受密码保护,是否可以在将其导入 JKS 密钥库之前为其添加密码?

Thanks!谢谢!

If you prefer a GUI solution I would take Portecle .如果您更喜欢 GUI 解决方案,我会选择Portecle This simple key store management tool allows to create a JKS and then import cert and private key.这个简单的密钥库管理工具允许创建 JKS,然后导入证书和私钥。

I am not sure if you can import cert and key from the same combined PEM file as you have it but may be the command "Import Key pair" of Portecle works with such a file.我不确定您是否可以从与您拥有的相同的组合 PEM 文件中导入证书和密钥,但可能是 Portecle 的命令“导入密钥对”适用于这样的文件。

If not you can simply split the PEM file directly after the -----END RSA PRIVATE KEY----- line into two PEM files and import them separately.如果不是,您可以简单地在-----END RSA PRIVATE KEY-----行之后直接将 PEM 文件拆分为两个 PEM 文件并分别导入它们。

After importing, when you save the JKS Portecle will ask you for a password.导入后,当您保存 JKS Portecle 时,会要求您输入密码。

门廊

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

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