Validation of the SMIME signature fails when the body includes a certificate chain and the signing cert is not first in the list.
The validation code is simply using the first certificate. It should examine the signature and use the certificate that matches that.