canonicalization when using Content-Tranfer-Encoding: binary

I am sending files using Mendelson AS2.

When using 'Content-Transfer-Encoding: binary', my partner gets signature verification errors if the original file uses "\n" for line endings.

The file content received by the partner has had the line endings changed from "\n" to "\r\n", but the digital signature was calculated on the original content, which used "\n". (We have verified that if the receiving side strips out the extra "\r" characters, we are able to get a successful signature verification.)

I'm wondering how a receiver could know it needs to apply this "\r\n" -> "\n" transformation in order to get a successful validation. I cannot see a solution other than 'try to verify, and if this fails, then try stripping "\r" from the message body and try again'. Can you suggest any other approach which would work?