尝试创建受密码保护的 PFX 文件会导致 openssl 错误:"



背景

  • 我们有微软Azure云托管
  • 从第三方(而非Microsoft)为我的域购买了通配符SSL证书
  • 创建CSR文件+私钥文件
  • 使用这些&已从SSL颁发者颁发x509PKCS7证书
  • Azure需要PFX文件,因此一直在尝试遵循ssl.com教程:https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/

问题

在本地机器上的终端中运行openssl命令(为可读性插入中断)

openssl pkcs12 -export -out certificate.pfx -password pass:somepassword
-inkey domain.key -in certificate.crt

我收到以下错误:

140735704675208:error:0906D06C:PEM routines:PEM_read_bio:no start line
:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22/libressl/crypto/pem/pem_lib.c:704:
Expecting: ANY PRIVATE KEY

但是我提供了钥匙?我很困惑。当谈到Azure时,我是SSL初学者。我做错了什么?

注意,我包含了-password参数,因为Microsoft Azure希望PFX文件受到密码保护。这不是可有可无的:他们必须受到保护

编辑

重新生成了CSR&密钥使用Openssl,我得到一个新的错误,即密钥文件无效。为了确保我不会错过一些显而易见的东西:

  • 我该如何处理X509
  • 我该如何处理PKCS7

厌倦了摆弄openssl和终端,所以找到了一个GUI来做这件事。步骤:

  • 复制X509内容,粘贴到代码编辑器中,另存为cert.pem
  • 复制私钥,粘贴到代码编辑器中,另存为private.key
  • 转到https://help.configuressl.com/ssl-tools/ssl-converter/,同时上传
  • 设置密码
  • 导出为PFX

这会生成一个受密码保护的PFX,然后可以将其上传到Azure。

最新更新