简体   繁体   English

将.pem公钥和私钥导入JKS密钥库

[英]Import .pem public and private keys to JKS keystore

I have public and private keys in separate .pem files that I would need to get into a JKS keystore somehow. 我在单独的.pem文件中有公钥和私钥,我需要以某种方式进入JKS密钥库。

Tried using the -import command in KeyTool for this, which gives an "not an X.509 certificate" error. 为此尝试在KeyTool中使用-import命令,这会产生“非X.509证书”错误。

I'm guessing the solution has to do with OpenSSL, but I'm not entirely sure what to do with it. 我猜这个解决方案与OpenSSL有关,但我不完全确定如何处理它。

Would really appreciate any help with this, since I'm completely clueless with everything crypto-related. 真的很感激任何帮助,因为我对所有与加密有关的东西都完全无能为力。

Thanks in advance, --Rolf 在此先感谢, - 罗尔夫

KeyTool expects the objects in DER format. KeyTool期望DER格式的对象。 PEM is Base64-encoded DER, with a header and a footer. PEM是Base64编码的DER,带有页眉和页脚。 KeyTool cannot parse PEM. KeyTool无法解析PEM。

However, OpenSSL can convert PEM objects to DER. 但是,OpenSSL可以将PEM对象转换为DER。 Eg, for an X.509 certificate, the -outform DER command-line flag instructs OpenSSL to use DER as its output format. 例如,对于X.509证书, -outform DER命令行标志指示OpenSSL使用DER作为其输出格式。

This page apparently contains some more detailed explanations. 该页面显然包含一些更详细的解释。

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

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