I'm using Debian and I'm trying to join on a file with a certificate.
I try to file.bin
+ cert.der
=> file.p7b
. To do so, I've tried with openssl command:
openssl pkcs7 -in cert.der -in file.bin -out file.p7b
But it gives me an error:
unable to load PKCS7 object
27849:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:647:Expecting: PKCS7
I've tried too
openssl pkcs7 -inform der -in cert.der -in file.bin -out file.p7b
which gave me
unable to load PKCS7 object
28160:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1306:
28160:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=PKCS7
What I really want is to sign the firmware. After a research I found the solution and I can't sign the firmware due I don't have the private key of the manufacturers and surely he doesn't will give it to me. Ok I can sign with my own priv. key but firmware will doesn't work because the pub. Key in modem doesn't match.
If I had the priv. key and I want to sign I will have to use the next command :
openssl smime –sign –in <unsigned_file.bin> –signer <sign_cert_file> –outform PEM –binary –inkey <sign_cert_pk_file> –out signed_file.p7b
Ref: https://www.openssl.org/docs/apps/smime.html