使用 SPC 文件在 Linux 上签名文件

发布于 2024-11-26 22:47:01 字数 806 浏览 11 评论 0原文

我有一个 .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 文件?

I have one .key file from which I generated a .csr file that I used to purchase a GoDaddy code signing certificate. From GoDaddy I received one .spc file.

I exported the spc file to pem with the following command:

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

I then opened the certs.pem file and copied the first two certificates to a file called cert-chain.crt and the last one (which is mine) to one called server.crt.

I tried to sign the file like with this command:

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

But what I got is:

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

What am I doing wrong? How should I normally sign the a.mobileconfig file with the provided SPC file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

煮茶煮酒煮时光 2024-12-03 22:47:01

您的证书采用 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

Your certificate is in DER format, but openssl is assuming PEM format. You should add -inform der to the command:

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文