2.2.3.3 Data Segment Encryption Header

 The Data Segment Encryption Header MUST be formatted as follows.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Starting File Offset

...

Length

Bytes Within Stream Size

Bytes Within VDL

0x0000

Data Unit Shift

Chunk Shift

Cluster Shift

0x01

Number of Data Blocks

Data Block Sizes (variable)

...

Extended Header (16 bytes, optional)

...

...

...

Starting File Offset (8 bytes): This field MUST contain an unsigned 64-bit integer in little-endian format denoting the offset, in bytes, into the stream being serialized of the first data byte contained in this data segment.

Length (4 bytes): The length of this header, in bytes, measured from the beginning of the Starting File Offset field to the end of the Data Segment Encryption Header. It MUST be a 32-bit unsigned integer in little-endian format. Any unused bytes within this structure MUST be set to zero and ignored by the server.

Bytes Within Stream Size (4 bytes): The number of bytes contained within this stream data segment that fall within the stream size. It MUST be a 32-bit unsigned integer in little-endian format. This can be less than the number of bytes actually present due to padding required by the encryption algorithm.

Bytes Within VDL (4 bytes): The number of bytes contained within this stream data segment that fall within the valid data length (VDL). It MUST be a 32-bit unsigned integer in little-endian format. This can be less than the number of bytes actually present due to padding required by the encryption algorithm. Bytes beyond the VDL MUST be set to zero after decryption.

Data Unit Shift (1 byte): The base-2 logarithm of the data unit size. It MUST be an 8-bit unsigned integer. For files that are not sparse files, the data unit size MUST be set to the size of the data in this segment. For sparse files, it MUST be equal to the size of a compression unit, which is the smallest unit that all holes MUST be a multiple of.

Chunk Shift (1 byte): The base-2 logarithm of the chunk size. It MUST be an 8-bit unsigned integer. The chunk size MUST be equal to the data unit size.

Cluster Shift (1 byte): The base-2 logarithm of the cluster size in bytes. It MUST be an 8-bit unsigned integer. It MUST be equal to the smallest unit of allocation in the underlying file system.

Number of Data Blocks (2 bytes): This field MUST contain the number of data blocks specified in this segment. It MUST be a 16-bit unsigned integer in little-endian format. It MUST be equal to the number of entries in the Data Block Sizes field specified next.

Data Block Sizes (variable): This field MUST consist of a sequence of unsigned 32-bit values in little-endian format, denoting the sizes of the successive data blocks in the Stream Data field that follows this header. Each value in the sequence MUST be less than or equal to the data unit size, unless it spans the VDL or a hole in the case of a sparse file.

Extended Header (16 bytes): This field is optional, and its presence is indicated by the four-byte signature located at the start of this field. If this field is present, the server SHOULD interpret it as defined in section 2.2.3.4. The server MAY ignore this field.<20>