【问题标题】:Signing files on Linux with SPC files在 Linux 上使用 SPC 文件对文件进行签名
【发布时间】:2011-10-15 04:37:33
【问题描述】:

我有一个 .key 文件,我从中生成了一个 .csr 文件,用于购买 GoDaddy 代码签名证书。我从 GoDaddy 收到了一个 .spc 文件。

我使用以下命令将 spc 文件导出到 pem:

openssl pkcs7 -inform DER -in mycert.spc -print_certs -out certs.pem 

然后我打开 certs.pem 文件并将前两个证书复制到名为 cert-chain.crt 的文件中,将最后一个(我的)复制到名为 server.crt 的文件中。

我尝试使用以下命令对文件进行签名:

openssl smime -sign -in a.mobileconfig -out signed_a.mobileconfig -signer cert/server.crt -inkey cert/ios_apn.key -certfile cert/cert-chain.crt -outform der -nodetach

但我得到的是:

unable to load certificate
11911:error:0906D06C:PEM routines:PEM_read_bio:no start line:/SourceCache/OpenSSL098/OpenSSL098-41/src/crypto/pem/pem_lib.c:648:Expecting: TRUSTED CERTIFICATE

我做错了什么?我通常应该如何使用提供的 SPC 文件对 a.mobileconfig 文件进行签名?

【问题讨论】:

    标签: certificate key code-signing pem code-signing-certificate


    【解决方案1】:

    您的证书采用 DER 格式,但 openssl 采用 PEM 格式。您应该在命令中添加-inform der:

    openssl smime -sign -in a.mobileconfig -out signed_a.mobileconfig -signer cert/server.crt -inkey cert/ios_apn.key -certfile cert/cert-chain.crt -inform der -outform der -nodetach
    

    【讨论】:

      猜你喜欢
      • 2015-07-02
      • 1970-01-01
      • 2013-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-02
      • 2011-05-11
      • 1970-01-01
      相关资源
      最近更新 更多