如何使用 GnuTLS 将 PEM 证书转换为 PKCS12

How do I convert a PEM cert to a PKCS12 with GnuTLS

我想使用 GnuTLS certtool 将 PEM public 和私钥转换为 PKCS12 pfx 包。我在目标系统上没有可用的 openssl。与 openssl 等效的命令是:

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
$ certtool --load-certificate certificate.pem --load-privkey certificate.pem --to-p12 --outder --outfile certificate.pfx