문제

According to the .ZIP File Format Specification (dated September 1, 2012), the overall .ZIP file format is as follows:

[local file header 1]
[encryption header 1]
[file data 1]
[data descriptor 1]
.
.
.
[local file header n]
[encryption header n]
[file data n]
[data descriptor n]
[archive decryption header]
[archive extra data record]
[central directory header 1]
.
.
.
[central directory header n]
[zip64 end of central directory record]
[zip64 end of central directory locator]
[end of central directory record]

I'm able to determine the presence/position of local file headers, central directory headers and the end of central directory record by means of the respective signatures.

How can I determine the existence or not of the encryption headers? Specifically, I want to know, for any given file with my zip, whether the file data immediately follows the local file header or not...

도움이 되었습니까?

해결책

Section 4.4.4 of the specification explains it:

4.4.4 general purpose bit flag: (2 bytes)

   Bit 0: If set, indicates that the file is encrypted.

Therefore, and given that the encryption header has a fixed size, you know what to do ;)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top