Class SignedChunksInputStream

java.lang.Object
java.io.InputStream
org.apache.hadoop.ozone.s3.SignedChunksInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class SignedChunksInputStream extends InputStream
Input stream implementation to read body of a signed chunked upload. This should also work with the chunked payloads with trailer.

Example chunk data:

 10000;chunk-signature=b474d8862b1487a5145d686f57f013e54db672cee1c953b3010fb58501ef5aa2\r\n
 <65536-bytes>\r\n
 400;chunk-signature=1c1344b170168f8e65b41376b44b20fe354e373826ccbbe2c1d40a8cae51e5c7\r\n
 <1024-bytes>\r\n
 0;chunk-signature=b6c6ea8a5354eaf15b3cb7646744f4275b71ea724fed81ceb9323e279d449df9\r\n
 x-amz-checksum-crc32c:sOO8/Q==\r\n
 x-amz-trailer-signature:63bddb248ad2590c92712055f51b8e78ab024eead08276b24f010b0efd74843f\r\n
 

For the first chunk 10000 will be read and decoded from base-16 representation to 65536, which is the size of the first chunk payload. Each chunk upload ends with a zero-byte final additional chunk. At the end, there might be a trailer checksum payload and signature, depending on whether the x-amz-content-sha256 header value contains "-TRAILER" suffix (e.g. STREAMING-AWS4-HMAC-SHA256-PAYLOAD-TRAILER and STREAMING-AWS4-ECDSA-P256-SHA256-PAYLOAD-TRAILER) and "x-amz-trailer" is specified (e.g. x-amz-checksum-crc32c).

The logic is similar to UnsignedChunksInputStream, but there is a "chunk-signature" to parse.

Note that there are no actual chunk signature verification taking place. The InputStream only returns the actual chunk payload from chunked signatures format.

Reference: