Error when validating signature (message-digest attribute value does not match calculated value)

See original GitHub issue

We are using your great MimeKit to handle AS2 messages in our software. And it’s running smoothly for almost all partners (and we have a lot). But we have an issue with one of them (OpenText/GXS) - we can’t validate their signature on the incoming mime-message.

I have tried a lot of different debugging, but I can’t figure out why we are getting the following error: "message-digest attribute value does not match calculated value"

My first thoughts was, that they (the external partner OpenText) was doing something wrong, but I then downloaded some Java AS2 software (OpenAS2 https://github.com/phax/as2-lib) and another .NET library (Chilkat) - and both of them can validate the signature of the message.

So I’m stuck here… Hopefully you can tell me, if I’m doing something wrong - or if there is something wrong with the mime-message.

Platform (please complete the following information):

  • OS: Windows
  • .NET Framework: 4.5+
  • MimeKit Version: 2.6

To Reproduce Steps to reproduce the behavior: I have create a small unit-test solution in VS2019, where I show the issue with MimeKit and a test-method showing that it works with Chilkat: UnitTestProject_Mimekit.zip

  1. Download the zip-file and unpack it
  2. Restore nuget packages in the solution
  3. Run the two test-methods in the test-class

Expected behavior I would expect the message to validate, since other frameworks validates the message. And OpenText are quite big, so I think they have a lot of partners where this is not an issue.

Screenshots image

Additional context I can see that the mime-message I’m working with from OpenText have a mix of Carriage-Return and Line-Feed. The mime-message contains both the carraige-return and line-feed (as it should), but the actual payload (the body) is using only line-feed (unix style). See the screenshot from notepad++ above. And I can see, that when I use the WriteTo method you provide, it will change the actual content of the body depending on the FormatOptions. I don’t know if this can be causing this issue?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
jstedfastcommented, May 19, 2020

Just published MimeKit 2.7.0 to nuget.org

1reaction
jstedfastcommented, May 19, 2020

BTW, thanks a ton for your generous donation. That was quite a surprise and very appreciated 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

BouncyCastle attribute messageDigest fail verification
I have a problem with signing/veryfing CADES signature usign BouncyCastle 1.59. I have to add messageDigest attribute but when I added it then ......
Read more >
verifying detached signature with BC error
CMSSignerDigestMismatchException : message-digest attribute value does not match calculated value sended email which i try to verify by sign and content:
Read more >
Verification of digital signature of inbound AS2 message ...
Error : Verification of digital signature of inbound AS2 message failed message-digest attribute value does not match calculated value.
Read more >
Troubleshooting Common Errors - CData Arc
The receipt signature could not be verified: Message digest was encrypted with unknown algorithm. Cause. This error indicates a known issue in older...
Read more >
PM46406: A ''DIGEST VALUE MISMATCH'' ERROR MAY ...
Error description​​ When WS-Security verifies an XML Digital Signature that uses the enveloped-signature transform, a 'Digest value mismatch' error may occur.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found