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

发布于 2024-08-25 12:36:31 字数 209 浏览 5 评论 0原文

我的公钥和私钥位于单独的 .pem 文件中,我需要以某种方式进入 JKS 密钥库。

为此尝试使用 KeyTool 中的 -import 命令,这会给出“不是 X.509 证书”错误。

我猜解决方案与 OpenSSL 有关,但我不完全确定如何处理它。

非常感谢对此的任何帮助,因为我对与加密相关的所有事情完全一无所知。

提前致谢, ——罗尔夫

I have public and private keys in separate .pem files that I would need to get into a JKS keystore somehow.

Tried using the -import command in KeyTool for this, which gives an "not an X.509 certificate" error.

I'm guessing the solution has to do with OpenSSL, but I'm not entirely sure what to do with it.

Would really appreciate any help with this, since I'm completely clueless with everything crypto-related.

Thanks in advance,
--Rolf

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜宝宝 2024-09-01 12:36:31

KeyTool 需要 DER 格式的对象。 PEM 是 Base64 编码的 DER,具有页眉和页脚。 KeyTool 无法解析 PEM。

但是,OpenSSL 可以将 PEM 对象转换为 DER。例如,对于 X.509 证书,-outform DER 命令行标志指示 OpenSSL 使用 DER 作为其输出格式。

此页面显然包含一些更详细的解释。

KeyTool expects the objects in DER format. PEM is Base64-encoded DER, with a header and a footer. KeyTool cannot parse PEM.

However, OpenSSL can convert PEM objects to DER. E.g., for an X.509 certificate, the -outform DER command-line flag instructs OpenSSL to use DER as its output format.

This page apparently contains some more detailed explanations.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文