使用中间证书将 PEM 转换为 PKCS12

Zty*_*tyx 6 openssl

我想将 PEM(+key) 证书转换为*.p12文件。我知道当我没有中级证书时,我是这样做的:

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
Run Code Online (Sandbox Code Playgroud)

有中级证书怎么办?

gar*_*Red 14

您需要将所有 PEM 文件连接为一个,然后将其转换为 PKCS#12:

$ cat certificate.crt intermediate.crt > bundle.crt
$ openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in bundle.crt
Run Code Online (Sandbox Code Playgroud)