Reputation: 2035
1: Created private key and certificate by using following command
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:4096 -keyout private.key -out certificate.crt
2: Have simple text file to sign
$ cat message.txt
this is a test file.
3: Signed it with
openssl cms -sign -in message.txt -text -out OutMessage.txt -inkey private.key -signer certificate.crt
4: for verification
openssl cms -verify -in OutMessage.txt -signer user.pem -out signedtext.txt
I am not sure why I am getting following error while verification step is performed, Please some one can help me out.
$ openssl cms -verify -in OutMessage.txt -signer user.pem -out signedtext.txt
Verification failure
140539655524800:error:2E099064:CMS routines:cms_signerinfo_verify_cert:certificate verify
error:../crypto/cms/cms_smime.c:253:Verify error:self signed certificate
Upvotes: 0
Views: 2246
Reputation: 3273
You're getting an error as you're using a self signed certificate, at least that's what the error is telling you. You can either add the certificate to your trust, or disable the certificate verify check when executing the command with the -no_signer_cert_verify
option.
Upvotes: 1