You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending a message with an attachment, the following error occurs:
The Message Integrity Code (MIC) does not match the sent AS2 message (required: **required_mic**, sha256, returned: **returned_mic**, sha256) {"message_id":"**message_id**"}
Meanwhile, sending a message without an attachment does not produce an error.
Steps to reproduce
This issue can be reproduced with the example, included in the library. To do that, run the following commands:
git clone https://github.com/tiamo/phpas2.git phpas2_issue_reproduction
cd phpas2_issue_reproduction/example
composer install
chmod +x ./bin/console
# run the server in the background with no output
php -S 127.0.0.1:8000 ./public/index.php >& /dev/null &echo"This is the message"> example_message.txt
php bin/console send-message --from mycompanyAS2 --to phpas2 --file example_message.txt
The last command produces the following output:
[2022-11-19 17:34:33] app.DEBUG: Build the AS2 message to send to the partner
[2022-11-19 17:34:33] app.DEBUG: Signing the message using partner key
[2022-11-19 17:34:33] app.DEBUG: Calculate MIC {"mic":"**mic**, sha256"}
[2022-11-19 17:34:33] app.DEBUG: Compressing outbound message after signing...
[2022-11-19 17:34:33] app.DEBUG: Encrypting the message using partner public key
[2022-11-19 17:34:33] app.DEBUG: AS2 message has been built successfully
[2022-11-19 17:34:33] app.DEBUG: AS2 message successfully sent to partner
[2022-11-19 17:34:33] app.DEBUG: Synchronous MDN received from partner
[2022-11-19 17:34:33] app.DEBUG: Found MDN report for message ["**message_id**"]
[2022-11-19 17:34:33] app.DEBUG: Message has been successfully processed, verifying the MIC if present.
[2022-11-19 17:34:33] app.ERROR: The Message Integrity Code (MIC) does not match the sent AS2 message (required: **required_mic**, sha256, returned: **returned_mic**, sha256) {"message_id":"**message_id**"}
However, if one were to run bin/console send-message --from mycompanyAS2 --to phpas2 (sending a message without an attachment) instead of the last command, the message would be sent successfully:
[2022-11-19 17:42:47] app.DEBUG: Build the AS2 message to send to the partner
[2022-11-19 17:42:47] app.DEBUG: Signing the message using partner key
[2022-11-19 17:42:47] app.DEBUG: Calculate MIC {"mic":"**mic**, sha256"} []
[2022-11-19 17:42:47] app.DEBUG: Compressing outbound message after signing...
[2022-11-19 17:42:47] app.DEBUG: Encrypting the message using partner public key
[2022-11-19 17:42:47] app.DEBUG: AS2 message has been built successfully
[2022-11-19 17:42:47] app.DEBUG: AS2 message successfully sent to partner
[2022-11-19 17:42:47] app.DEBUG: Synchronous MDN received from partner
[2022-11-19 17:42:47] app.DEBUG: Found MDN report for message ["**message_id**"]
[2022-11-19 17:42:47] app.DEBUG: Message has been successfully processed, verifying the MIC if present.
[2022-11-19 17:42:47] app.DEBUG: File Transferred successfully to the partner
Overview
When sending a message with an attachment, the following error occurs:
Meanwhile, sending a message without an attachment does not produce an error.
Steps to reproduce
This issue can be reproduced with the example, included in the library. To do that, run the following commands:
The last command produces the following output:
However, if one were to run
bin/console send-message --from mycompanyAS2 --to phpas2
(sending a message without an attachment) instead of the last command, the message would be sent successfully:System information
The text was updated successfully, but these errors were encountered: