Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Transfter-Encoding not specified in headers #71

Closed
keithveeva opened this issue Oct 1, 2018 · 14 comments
Closed

Content-Transfter-Encoding not specified in headers #71

keithveeva opened this issue Oct 1, 2018 · 14 comments
Assignees
Milestone

Comments

@keithveeva
Copy link

Hi Pillip,

Our project uses your as2-lib core library to handle our AS2 communication and we cannot seem to be able to send the Content-Transfter-Encoding header (CTE) in our message. We set it explicitly in our message and it looks to be picked up by your code, but digging into the underlying sdk call it looks like this header is on a list of restricted headers, can you confirm if this is the case or how can we enable this in your library? Looking at the sdk code this is controlled by a system property, ideally we would like to NOT turn this system property on, please let me know if there are any other options.

Thanks,
Keith

@phax phax self-assigned this Oct 1, 2018
@phax
Copy link
Owner

phax commented Oct 1, 2018

Hi Keith,
I'm aware of this situation, as I myself was struggeling with that.
That is one of the reasons I didn't release 4.2.0 yet.
The Content-Transfer-Encoding (CTE) can basically be set for the payload as well as for the certificate part.
Unfortunately when using encryption it seems like the CTE is not properly honored from within BC (or at least I didn't find out how).
It would be great if you could confirm that this only affects encrypted messages.
Thanks, Philip

@keithveeva
Copy link
Author

keithveeva commented Oct 1, 2018 via email

@keithveeva
Copy link
Author

keithveeva commented Oct 1, 2018 via email

@phax
Copy link
Owner

phax commented Oct 1, 2018

I assume you refer to AS2ClientRequest.setContentTransferEncoding which was introduced in 3.0.4.
And this is exactly what is not working properly in all cases :(

@keithveeva
Copy link
Author

keithveeva commented Oct 1, 2018 via email

@phax
Copy link
Owner

phax commented Oct 2, 2018

That sounds pretty okay to me :) The layout of a multipart message is like this (source):

 MIME-Version: 1.0
 Content-Type: multipart/mixed; boundary=frontier

 This is a multi-part message in MIME format.
 
 --frontier
 Content-Type: text/plain

 This is the body of the message.
 --frontier
 Content-Type: text/html
 Content-Transfer-Encoding: base64

 PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
 Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
 --frontier--

As every part can have it's own CTE (as shown in the example), you cannot use it on top-level. When using AS2 the first part would be the payload (for which the CTE can be set) and the second part would be the signature (for which no CTE can be set).
My issue is, that I can't get the CTE working for the first block

@keithveeva
Copy link
Author

keithveeva commented Oct 2, 2018 via email

@phax
Copy link
Owner

phax commented Oct 2, 2018

Hi Keith,
I think I found the reason, it just takes a bit to implement everything.
The current situation is a bit of a mess, because the current version contains old "HttpUrlConnection" as well as mew "HttpClient" based implementations in parallel.
So I need to fix it for both, release 4.2.0 and than get rid of the old version.
// Philip

@keithveeva
Copy link
Author

keithveeva commented Oct 2, 2018 via email

@phax phax added the bug label Oct 3, 2018
@phax phax added this to the 4.2.0 milestone Oct 3, 2018
@phax
Copy link
Owner

phax commented Oct 25, 2018

So it took some time but I finally managed to get the Content-Transfer-Encoding thing working. It works at least with the new "large file support" version based on Apache HTTP Client. I'm still struggeling with the old "HttpURLConnection" version, because of this "forbidden header" thingy.
The workaround according to https://bugs.openjdk.java.net/browse/JDK-6996110 is to specify the system property -Dsun.net.http.allowRestrictedHeaders=true on the commandline.

@phax
Copy link
Owner

phax commented Oct 25, 2018

Additionally "compress before signing" does not work with Content-Transfer-Encoding other than "binary". I'm investigating this

@phax phax modified the milestones: 4.2.0, 4.2.1 Nov 20, 2018
@stale
Copy link

stale bot commented May 14, 2019

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.

@stale stale bot added the wontfix label May 14, 2019
@phax phax added pinned and removed wontfix labels May 15, 2019
@phax phax modified the milestones: 4.3, 4.4 May 27, 2019
@phax
Copy link
Owner

phax commented May 27, 2019

With #87 the HttpUrlConnection is gone

@phax
Copy link
Owner

phax commented May 27, 2019

Now the CTE can be set and the MIC calculation is consistent with the one from Mendelson

@phax phax closed this as completed May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants