bc-java icon indicating copy to clipboard operation
bc-java copied to clipboard

ESTService.getCSRAttributes can't read response body

Open mkarasik opened this issue 5 years ago • 5 comments

ESTService getCSRAttributes can't read response body. ESTException is returned with no body and message: Stream closed before limit fully read, Read: 0 ContentLength: 55 HTTP Status Code: 404

getCACerts and simpleEnroll can do it w/o problems, the server behaves the same for all cases.

mkarasik avatar Sep 08 '20 15:09 mkarasik

If you can provide a sample response we might be able to work out what's going on.

dghgit avatar Oct 31 '20 01:10 dghgit

As far as I remember it was 404 response with 55 bytes of data as error message in JSON format.

mkarasik avatar Oct 31 '20 02:10 mkarasik

So the issue was generating a response that the server couldn't read?

dghgit avatar Oct 31 '20 02:10 dghgit

Opposite, server was responding with 404 and body. Give me an hour I'll bring my setup and try to reproduce the issue.

mkarasik avatar Oct 31 '20 02:10 mkarasik

Here is what happens. Server responds with 404 and some body.

getCsrAttributes comes to the line

https://github.com/bcgit/bc-java/blob/master/pkix/src/main/java/org/bouncycastle/est/ESTService.java#L540

than continue to

https://github.com/bcgit/bc-java/blob/master/pkix/src/main/java/org/bouncycastle/est/ESTService.java#L566

which throws java.io.IOException: Stream closed before limit fully read, Read: 0 ContentLength: 45

mkarasik avatar Oct 31 '20 03:10 mkarasik