[ https://issues.apache.org/jira/browse/CAMEL-21505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17911945#comment-17911945 ]
Jono Morris edited comment on CAMEL-21505 at 1/11/25 10:56 AM: --------------------------------------------------------------- Looking at sections 3.4 and 3.5 of AS2 spec [1], AS2 appears to be primarily designed for sending EDI messages using 7-bit US-ASCII. Camel-AS2 provides EDIFACT, EDI-X12, EDI-CONSENT, and XML entity types, all of which only support text. However, I've found that Zip content can be sent if it is first Base64 encoded, and I've created a few examples [2]. 1. [https://www.ietf.org/rfc/rfc4130.txt] 2. [https://github.com/apache/camel/compare/main...jonomorris:camel:CAMEL-21505_zipfile_example?expand=1] was (Author: jono): Looking at sections 3.4 and 3.5 of AS2 spec [1], AS2 appears to be primarily designed for sending EDI messages using 7-bit US-ASCII. Camel-AS2 provides EDIFACT, EDI-X12, EDI-CONSENT, and XML entity types, all of which only support text. However, I've found that Zip content can be sent if it is first Base64 encoded, and I've created a few examples [2]. 1. https://www.ietf.org/rfc/rfc4130.txt 2. https://github.com/apache/camel/compare/main...jonomorris:camel:CAMEL-21505_zipfile_example?expand=1 > camel-as2: Binary files get corrupt when using 'base64' content transfer > encoding > --------------------------------------------------------------------------------- > > Key: CAMEL-21505 > URL: https://issues.apache.org/jira/browse/CAMEL-21505 > Project: Camel > Issue Type: Bug > Components: camel-as2 > Affects Versions: 4.8.1 > Environment: Windows and Docker > Java 21 Temurin > Reporter: Meinolf S-D > Priority: Minor > Fix For: 4.8.4, 4.10.0 > > Attachments: image-2024-12-03-12-29-47-487.png, > image-2025-01-10-15-09-59-096.png > > > Binary files get corrupt when using *base64* content transfer encoding due to > String assignment of the decoded byte[] > This can easily be tested sending a .zip file to Camel AS2 listener. > After some investigation the issue seems to be in the EntityUtil.decode > method. > As shown in the screenshot the decoded (binary) byte[] is assigned to a new > String which result into corrupt date in case of binary content. > !image-2024-12-03-12-29-47-487.png! > In addition there are new line characters in the encoded base64 encoded > String data object. > In case of using transfer encoding type *binary* > java.nio.charset.MalformedInputException: Input length = 1 it thrown which > might be OK. -- This message was sent by Atlassian Jira (v8.20.10#820010)