使用openssl将多个证书加载到PKCS12中
我正在尝试使用openssl将多个证书加载到PKCS12格式。命令如下:使用openssl将多个证书加载到PKCS12中,openssl,x509certificate,pkcs#12,Openssl,X509certificate,Pkcs#12,我正在尝试使用openssl将多个证书加载到PKCS12格式。命令如下: openssl pkcs12 -export -in cert1.arm -inkey cert1_private_key.pem -certfile cert2.arm -certfile cert3.arm -certfile RootCert.pem -name "Test" -out test.p12 解析生成的PKCS12文件后,文件中只包含最后一个证书: openssl pkcs12 -in test.p12
openssl pkcs12 -export -in cert1.arm -inkey cert1_private_key.pem -certfile cert2.arm -certfile cert3.arm -certfile RootCert.pem -name "Test" -out test.p12
解析生成的PKCS12文件后,文件中只包含最后一个证书:
openssl pkcs12 -in test.p12 -info -nodes
我还尝试将它们分别导入pkcs12文件,而在所有尝试中,文件中只保留了最后一个证书
知道问题在哪里吗?首先,确保所有证书都是PEM格式的。然后,创建一个名为“certs.pem”的文件,其中包含其余证书(cert2.arm、cert3.arm和RootCert.pem) 然后使用如下命令:
openssl pkcs12 -export -in cert1.arm -inkey cert1_private_key.pem -certfile certs.pem -name "Test" -out test.p12
文档解释了不同的选项。是否有自动执行的方法?手动将证书添加到单个文件似乎不太实际(当涉及到从PKCS12文件添加/删除证书时)。您可以在创建PKCS12文件的同一命令行上将各个文件连接到一个组合文件中。例如,在Windows中,
键入cert2.arm cert3.arm RootCert.pem>combined.pem和openssl pkcs12…
。在Linux/Unix中,您可以执行cat cert2.arm cert3.arm RootCert.pem>combined.pem;openssl pkcs12…
是否有任何方法可以使用openssl
将证书添加到现有的pkcs12
文件中?我知道你可以从头组装一个,但是只添加一个怎么样?