Skip to content

Conversation

@alvarolivie
Copy link

@alvarolivie alvarolivie commented Dec 8, 2025

  • Move MIC calculation to after decryption/verification
  • Calculate MIC on first body part of multipart/signed messages
  • Ensures MIC is calculated on same data as sender

In theory, MIC is calculated before signature and encryption. If the content is compressed before encryption then MIC should be calculated on the compressed object. I've tested both sending and receiving with mendelson.

Java is not my main language so please feel free to edit and fix. I tried to implement what would work in my use case but copying how the sending worked with callbacks. #140

- Move MIC calculation to after decryption/verification
- Calculate MIC on first body part of multipart/signed messages
- Ensures MIC is calculated on same data as sender
@phax
Copy link
Owner

phax commented Dec 8, 2025

Thx - will check asap

@alvarolivie
Copy link
Author

One issue I have found with this is that between a partnership, if the sender does not use the defined values but instead sends new ones in the header the server will respond with the values defined in the partnership. For example, if a partnership A-B is defined with sign: sha-256 but the sender sends without signature then the server will accept the incoming request but it will calculate the MIC with headers as the partnership states that they use signature. The server responds with a signature and a wrong MIC. In my opinion the server should directly reject the request because the sender did not comply with the agreement but I may be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants