phax / as2-lib

A generic Java AS2 library, servlet and server
107 stars 43 forks source link

MIC isn't matched when using compress before signing flag #68

Closed ihudedi closed 5 years ago

ihudedi commented 6 years ago

Hi Philip, When using compressBeforeSigning flag (settings.setCompress(type,true) the following actions are performed for the message in AS2SenderModule: compress sign encrypt

but in AS2ReceiverHandler we are doing: decrypt compress verify

and the mic isn't matched because the data isn't the same. if I change to use compress after sign as: sign compress encrypt

then the mic is matched.

Is it bug ? or need to add parameters to check if aPartnership.isCompressBeforeSign () and perfom the same logic as we do in send message.I am not sure if all params are set in the partnership there and maybe needs to pass them via headers/attributes of the message to the partnership object.

Thanks, Itay

phax commented 6 years ago

That setting is there to support legacy AS2 systems. The default value true should match the default setup. Just change this if your partner does it incorrectly...

ihudedi commented 6 years ago

I am using the client server of as2 library and it isn't working.

phax commented 6 years ago

So you mean the documentation is invalid and should be updated?

ihudedi commented 6 years ago

I mean you have 2 cases in compress before and after the sign and you handle it client but in server you support only compress after sign.maybe adding attribute to config.xml and handle in recieverhandler.

ihudedi commented 6 years ago

Hi Philip, I run the medelson test with compress before sign and after sign and the MIC is matched for the 2 cases against mendleson test server.Look like there is an issue with AS2 server with MIC calculation. For now only the compress after sign is working against AS2 server. Thanks, Itay

ihudedi commented 6 years ago

Do you have an idea how mendelson server calculate mic for both cases and its matched to the mic calculate in client while as2 server failed?

phax commented 6 years ago

Hi. I have no idea how Mendelson does it. I want to check the specifications first before making a decision here :)

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

phax commented 5 years ago

I checked with the latest version (4.4) - MIC is matched in both cases

camiloh commented 1 year ago

I've had the same issue where the MIC generated by as2-lib server does not match what the sender expects when compression is on but it does match when compression is off. I've tested with both mendelson AS2 and SAP B2B Toolkit 2.0 as the sender and both had the same issue.

phax commented 1 year ago

@camiloh if this is an issue, please open a new request and add some details (like version, standalone or as servlet) etc. Thanks :)