Hi,
I'm struggling with this since yesterday and I don't see an error. Attached
you can find my JUnit test class that reproduces the problem I see with my
"real" test case (that's the reason why there is non-ascii data, changing that
to pure ascii has no effect on the problem). Here's what I'm doing:
- Creating a MimeBodyPart, containing a multipart/alternative block with text/plain
and text/html data, that has been added to a multipart/mixed block together
with an attachment containing a text-file
- Signing the MimeBodyPart the "usual" way, i.e. the way you e.g. find it
in the example files that are provided with BC itself.
- Put the resulting MimeMultipart into a MimeBodyPart and use that to
verify the signature, again the "normal" way.
Whatever I try, I always get a verification check error:
org.bouncycastle.cms.CMSSignerDigestMismatchException: message-digest attribute value does not match calculated value
at org.bouncycastle.cms.SignerInformation.doVerify(Unknown Source)
at org.bouncycastle.cms.SignerInformation.verify(Unknown Source)
at __Run_SMIMESigning.testMailSigning(__Run_SMIMESigning.java:77)
The strange thing is: When I compress before signing, the signature verifcation
check succeeds, the same is the case when I encrypt the signed data afterwards.
I can understand the former in some way but the latter is what I don't get.
I'd really appreciate if somebody can point me where I do something wrong,
because after staring on it for nearly a day, I've gone blind I suppose.
Thanks and best regards,
Lothar Kimmeringer