Signing files on Linux using SPC files

I have one .key file from which I generated the .csr file that I used to buy the GoDaddy code signing certificate. From GoDaddy I got 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 

Then I opened the certs.pem file and copied the first two certificates to a file called cert-chain.crt and the last (which belongs to me) to one .crt server being called.

I tried to sign the file, as 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 I have:

 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 a.mobileconfig file with the provided SPC file?

+4
source share
1 answer

Your certificate is in DER format, but openssl accepts the PEM format. You must 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 
+1
source

All Articles