localfile header signature 4bytes (0x04034b50) version needed to extract 2bytes general purpose bit flag 2bytes compression method 2bytes lastmodfiletime2bytes lastmodfiledate2bytes crc-324bytes compressed size 4bytes uncompressed size 4bytes file name length2bytes extra field length2bytes
file name (variable size) extra field (variable size)
The minimum supported ZIP specification version needed to extract the file, mapped as above. This value is based on the specific format features a ZIP program must support to be able to extract the file. If multiple features are applied to a file, the minimum version should be setto the feature having the highest value. New features or feature changes affecting the published format specification will be implemented using higher version numbers than the last published valueto avoid conflict.
Currentminimum feature versionsareas defined below:
1.0 - Defaultvalue 1.1 - Fileis a volume label 2.0 - Fileis a folder (directory) 2.0 - Fileis compressed using Deflate compression 2.0 - Fileis encrypted using traditional PKWARE encryption 2.1 - Fileis compressed using Deflate64(tm) 2.5 - Fileis compressed using PKWARE DCL Implode 2.7 - Fileis a patchdataset 4.5 - File uses ZIP64 format extensions 4.6 - Fileis compressed using BZIP2 compression* 5.0 - Fileis encrypted using DES 5.0 - Fileis encrypted using3DES 5.0 - Fileis encrypted using original RC2 encryption 5.0 - Fileis encrypted using RC4 encryption 5.1 - Fileis encrypted using AES encryption 5.1 - Fileis encrypted using corrected RC2 encryption** 5.2 - Fileis encrypted using corrected RC2-64 encryption** 6.1 - Fileis encrypted using non-OAEP key wrapping*** 6.2 - Central directory encryption
* Early 7.x (pre-7.2) versionsof PKZIP incorrectly set the version needed toextractfor BZIP2 compression to be 50 when it should have been 46.
** Refer to the sectionon Strong Encryption Specification for additional information regarding RC2 corrections.
*** Certificate encryption using non-OAEP key wrapping is the intended modeof operation forallversionsbeginningwith6.1. Support for OAEP key wrapping should only be used for backward compatibilitywhen sending ZIP files to be opened by versionsof PKZIP older than6.1 (5.0or6.0).
Whenusing ZIP64 extensions, the correspondingvaluein the Zip64 endof central directoryrecord should also be set. This field currently supports only the value45to indicate ZIP64 extensions are present.
(see accompanying documentation for algorithm descriptions)
0 - The file is stored (no compression) 1 - The file is Shrunk 2 - The file is Reduced with compression factor 1 3 - The file is Reduced with compression factor 2 4 - The file is Reduced with compression factor 3 5 - The file is Reduced with compression factor 4 6 - The file is Imploded 7 - Reserved for Tokenizing compression algorithm 8 - The file is Deflated 9 - Enhanced Deflating using Deflate64(tm) 10 - PKWARE Data Compression Library Imploding 11 - Reserved by PKWARE 12 - File is compressed using BZIP2 algorithm
last mod file time
last mod file date
file name length
extra field length
file name (variable size)
extra field (variable size)
End of central directory record
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
I. Endof central directoryrecord:
endof central dir signature 4bytes (0x06054b50) numberof this disk 2bytes numberof the disk with the startof the central directory2bytes total numberof entries in the central directoryon this disk 2bytes total numberof entries in the central directory2bytes sizeof the central directory4bytes offsetofstartof central directorywithrespectto the starting disk number4bytes .ZIP filecommentlength2bytes .ZIP filecomment (variablesize)
local file header signature
文件尾签名：50 4B 05 06
number of this disk
number of the disk with the start of the central directory
total number of entries in the central directory on this disk
total number of entries in the central directory
size of the central directory
中央目录大小：BC 00 00 00
offset of start of central directory with respect to the starting disk number
central file header signature 4bytes (0x02014b50) version made by2bytes version needed to extract 2bytes general purpose bit flag 2bytes compression method 2bytes lastmodfiletime2bytes lastmodfiledate2bytes crc-324bytes compressed size 4bytes uncompressed size 4bytes file name length2bytes extra field length2bytes file comment length2bytes disk numberstart2bytes internal file attributes 2bytes external file attributes 4bytes relativeoffsetoflocal header 4bytes
file name (variable size) extra field (variable size) file comment (variable size)
header signature 4bytes (0x05054b50) size of data 2bytes signature data (variable size)
With the introduction ofthe Central Directory Encryption feature inversion6.2of this specification, the Central Directory Structure may be stored both compressed and encrypted. Although not required, it is assumed when encrypting the Central Directory Structure, that it will be compressed for greater storage efficiency. Information onthe Central Directory Encryption feature can be found inthe section describing the Strong Encryption Specification. The Digital Signature record will be neither compressed nor encrypted.