openssl - 我可以在没有私钥的情况下将多个证书合并为一个吗?

标签 openssl chain

我需要在许多设备中拥有最新的证书信任存储,因此我希望能够将它们合并到证书中,然后我可以推送该一个文件。我只想捆绑多个 CA 的公钥,但我不想添加私有(private)文件,因为我想要将证书推送到我的所有设备。我认为这个功能被称为链,但 openssl 不会在没有私有(private)文件的情况下接受命令。这可以做到吗?我尝试了几种不同的方法,并且在这里查看了很多线程,但我不知道我在做什么。

编辑

我尝试使用的命令是:

openssl -export -pkcs12 -out output.pem -cafile intermediate.pem

编辑

我尝试了“openssl crl2pkcs7 -certfile bundle.pem -out p7.pem”,但它产生了一个错误:

openssl crl2pkcs7 -certfile bundle.pem -out p7.pem
unable to load CRL
9460:error:0906D06C:PEM routines:PEM_read_bio:no start line:.\crypto\pem\pem_lib.c:701:Expecting: X509 CRL

我也尝试过:

openssl pkcs7 -in bundle.pem -out p7.pem
unable to load PKCS7 object
3676:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:.\crypto\asn1\tasn_dec.c:1201:
3676:error:0D06C03A:asn1 encoding routines:ASN1_D2I_EX_PRIMITIVE:nested asn1 error:.\crypto\asn1\tasn_dec.c:765:
3676:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:.\crypto\asn1\tasn_dec.c:697:Field=type, Type=PKCS7
3676:error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib:.\crypto\pem\pem_oth.c:83:

最佳答案

如果您已经拥有证书,则可以简单地将它们连接起来:

cat cert1.pem cert2.pem > bundle.pem

但是,这实际上取决于每个信任存储所期望的格式。例如,Public Key Cryptography Standards描述了可用于分发证书、 key 等的几种标准。其中之一是 PKCS#7,它通常用于捆绑一组没有私钥的证书。您可能需要了解每个设备如何实现信任存储,因为它们可能都需要不同的格式。

关于openssl - 我可以在没有私钥的情况下将多个证书合并为一个吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36043272/

相关文章:

c - pem 的 openssl Diffie Hellman 公钥

c - 将变量传递给 popen 命令

python - 将 celery 任务的结果链接到分布式组中

python - 如何通过组合元组和静态字符串来使用 itertools 创建字典

javascript - 如何在点击时触发第二个动画

c - libssh2 channel SSL BIO 使用

java - 在 java 中生成密码哈希,如 openssl passwd -1

ssl - 使用 OpenSSL 测试 SSL/TLS 客户端身份验证

javascript - jQuery 链接自定义函数

任意对象、类的 ruby​​ 方法链接