The extra field is where a ZIP header carries anything the fixed fields do not: 64-bit sizes, exact times, Unix owners, Unicode names, alignment padding. Each local and central header has its own, and the two can differ.
Block layout
An extra field is a sequence of blocks, with no padding between them.
| Offset | Size | Name | Description |
|---|---|---|---|
0 | 2 | Header ID | Says what the block is. |
2 | 2 | Data size | The size of the data after these 4 bytes. |
4 | data size | Data | The block’s data. |
IDs 0 to 31 are reserved for PKWARE. The whole extra field is limited by its 16-bit length, and APPNOTE says the name, extra field and comment together should not generally exceed 65,535 bytes. A reader should skip IDs it does not know, using the data size, and check that each block fits.
Some writers put bytes in the extra field that are not blocks. Older Android
zipalign padded with zeros, too few to be a block, and at least one
program kept unrelated data there. The explorer treats fewer than 4 leftover bytes as
padding, and a field whose first block cannot fit as unstructured data.
Header IDs
PKWARE’s IDs
| ID | Name |
|---|---|
0x0001 | ZIP64 extended information |
0x0007 | AV Info |
0x0008 | Extended language encoding (reserved) |
0x0009 | OS/2 |
0x000A | NTFS |
0x000C | OpenVMS |
0x000D | Unix |
0x000E | File stream and fork descriptors (reserved) |
0x000F | Patch descriptor |
0x0014 | PKCS#7 store for X.509 certificates |
0x0015 | X.509 certificate ID and signature for a file |
0x0016 | X.509 certificate ID for the central directory |
0x0017 | Strong encryption header |
0x0018 | Record management controls |
0x0019 | PKCS#7 encryption recipient certificate list |
0x0020 | Timestamp record (reserved) |
0x0021 | Policy decryption key record |
0x0022 | Smartcrypt key provider record |
0x0023 | Smartcrypt policy key data record |
0x0065 | IBM S/390 (Z390), AS/400 (I400) attributes, uncompressed |
0x0066 | IBM S/390 (Z390), AS/400 (I400) attributes, compressed (reserved) |
0x4690 | POSZIP 4690 (reserved) |
Third-party IDs
APPNOTE lists these IDs, assigned or taken by other software.
| ID | Name |
|---|---|
0x07C8 | Macintosh |
0x1986 | Pixar USD |
0x2605 | ZipIt Macintosh |
0x2705 | ZipIt Macintosh 1.3.5 and later |
0x2805 | ZipIt Macintosh 1.3.5 and later |
0x334D | Info-ZIP Macintosh |
0x4154 | Tandem |
0x4341 | Acorn SparkFS |
0x4453 | Windows NT security descriptor (binary ACL) |
0x4704 | VM/CMS |
0x470F | MVS |
0x4854 | THEOS (old) |
0x4B46 | FWKCS MD5 |
0x4C41 | OS/2 access control list (text ACL) |
0x4D49 | Info-ZIP OpenVMS |
0x4D63 | Macintosh SmartZIP |
0x4F4C | Xceed original location |
0x5356 | AOS/VS (ACL) |
0x5455 | Extended timestamp |
0x554E | Xceed Unicode |
0x5855 | Info-ZIP Unix (original) |
0x6375 | Info-ZIP Unicode comment |
0x6542 | BeOS and BeBox |
0x6854 | THEOS |
0x7075 | Info-ZIP Unicode path |
0x7441 | AtheOS and Syllable |
0x756E | ASi Unix |
0x7855 | Info-ZIP Unix (new) |
0x7875 | Info-ZIP Unix (newer owner IDs) |
0x9901 | AE-x encryption structure |
0x9902 | Unknown |
0xA11E | Data stream alignment (Apache Commons Compress) |
0xA220 | Microsoft Open Packaging growth hint |
0xCAFE | Java JAR marker |
0xD935 | Android ZIP alignment |
0xE57A | Korean ZIP code page |
0xFD4A | SMS/QDOS. APPNOTE gives this number; Info-ZIP’s extrafld.txt gives 0xFB4A for the same block, and the explorer reads both as the layout in SMS/QDOS. |
The layouts of the IDs without a section of their own are in other published layouts, and the ones that have never been described are listed in IDs without a published layout.
ZIP64, 0x0001
Described on the ZIP64 page. The fields present depend on which header fields hold sentinels.
NTFS, 0x000A
Three 8-byte file times in NTFS format, in units of 100 nanoseconds since 1 January 1601 UTC.
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0x000A |
| 2 | TSize | The total size of what follows. |
| 4 | Reserved | Zero. |
| 2 | Tag1 | 0x0001, the only attribute defined. |
| 2 | Size1 | 24. |
| 8 | Mtime | Last modification. |
| 8 | Atime | Last access. |
| 8 | Ctime | Creation. |
Patch descriptor, 0x000F
Marks a member as patch data. After the tag and size:
| Size | Name |
|---|---|
| 2 | Version |
| 4 | Flags |
| 4 | Old size |
| 4 | Old CRC |
| 4 | New size |
| 4 | New CRC |
Flags bit 0 is for auto-detection, bit 1 means a self-patch, bits 4 and 5 are the action (0 none, 1 add, 2 delete, 3 patch), bits 8 and 9, 10 and 11, and 12 and 13 are the reaction to an absent, newer and unknown file (0 ask, 1 skip, 2 ignore, 3 fail). The rest are reserved.
PKWARE Unix, 0x000D
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0x000D |
| 2 | TSize | The total size of what follows, at least 12. |
| 4 | Atime | Last access, Unix seconds. |
| 4 | Mtime | Last modification, Unix seconds, UTC. |
| 2 | Uid | User ID. |
| 2 | Gid | Group ID. |
| varies | Data | For a symbolic or hard link, its target with no NUL; for a device, two 4-byte little-endian numbers, major then minor. |
Extended timestamp, 0x5455
Info-ZIP’s Unix times, also known as UT.
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0x5455 |
| 2 | TSize | 1 + 4 × the number of times present. |
| 1 | Flags | Bit 0 modification time present, bit 1 access time, bit 2 creation time. Bits 3 to 7 are reserved and must be clear. |
| 4 | ModTime | Present if flagged. |
| 4 | AcTime | Present if flagged. |
| 4 | CrTime | Present if flagged. |
Times are signed 32-bit Unix seconds, UTC. In a central header, the flags still describe the local header but only the modification time is stored, so TSize is 5 or 1. A reader that decodes by flags alone reads off the end of a central block. Use TSize. Info-ZIP’s extrafld.txt adds a rule for writers: if the flags say the modification time is present in the local header, it must be present in the central header too, because the value is used for freshening and updating across time zones. It also says TSize should equal 1 + 4 × the number of bits set in Flags, as the block is defined now.
Info-ZIP Unix type 1, 0x5855
Obsolete, and to be read but not written. UX in the file. Ignored if
0x5455 or 0x7855 is also present.
| Size | Name | Description |
|---|---|---|
| 4 | AcTime | Access time, Unix seconds. |
| 4 | ModTime | Modification time, Unix seconds. |
| 2 | UID | Local header only, and optional: TSize says. |
| 2 | GID | Local header only, and optional: TSize says. |
Info-ZIP Unix type 2, 0x7855
Ux in the file. In a local header, TSize is 4, followed by UID (2) and
GID (2). In a central header, TSize is 0 and there is no data: its presence only says
the local header has the field.
Info-ZIP Unix type 3, 0x7875
ux in the file. It can hold larger owner IDs than 0x7855, whose values
it overrides.
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0x7875 |
| 2 | TSize | The total data size of the block (extrafld.txt: “total data size for this block”): 3 + UIDSize + GIDSize. |
| 1 | Version | 1. Ignore the block if unknown. |
| 1 | UIDSize | Size of the next field. |
| UIDSize | UID | Little-endian. |
| 1 | GIDSize | Size of the next field. |
| GIDSize | GID | Little-endian. |
Unicode path, 0x7075
up in the file. Used to give a UTF-8 name while the header keeps an older
encoding for old tools. See File names.
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0x7075 |
| 2 | TSize | |
| 1 | Version | 1. Ignore the block if unknown. |
| 4 | NameCRC32 | The CRC-32 of the header’s name field. |
| TSize − 5 | UnicodeName | The name, UTF-8, no byte order mark. |
If the CRC-32 does not match the header’s name, the header was changed by a tool that did not update this block, so the block should not be used and the header’s name is used instead. APPNOTE 4.6.8 and 4.6.9 say the field SHOULD be ignored in that case; Info-ZIP’s extrafld.txt says it “shall not be used”. APPNOTE says the fields SHOULD NOT be created when general purpose bit 11 is set and both the name and the comment are UTF-8 (the condition is the pair, not the name alone).
Rules from Info-ZIP’s extrafld.txt (“Utilisation rules”) for the Unicode path field: (1) the field shall never be created for a name made only of 7-bit ASCII characters. (2) On a system that already uses UTF-8, the field shall not repeat the name already in the header; instead a field of exactly 9 bytes should be created, which the file writes as “70 75 05 00 01 and 4 bytes CRC”. With its 5 data bytes (Version and the CRC-32, no name) it only indicates that the header’s own name is UTF-8. (Little-endian, the tag 0x7075 is the bytes 75 70; the bytes as printed in extrafld.txt are in the other order, a point the file does not explain.) (3) The field shall not be used when the CRC-32 of the header’s name does not match.
Unicode comment, 0x6375
uc in the file. The same layout as the Unicode path, in a central header,
with ComCRC32 computed over the central header’s comment.
WinZip AES, 0x9901
Marks a member as AE-1 or AE-2 encrypted. Present in both headers, with method set to 99.
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0x9901 |
| 2 | TSize | 7, at present. |
| 2 | Version | 0x0001 AE-1 or 0x0002 AE-2. |
| 2 | Vendor ID | The characters AE. |
| 1 | Strength | 0x01 128-bit, 0x02 192-bit, 0x03 256-bit. |
| 2 | Method | The real compression method. |
See WinZip AES for how the data is protected.
FWKCS MD5, 0x4B46
FK in the file. It exists only in the central header; there is no local
version (extrafld.txt). When FWKCS adds it, it also replaces that central directory
entry’s uncompressed size with a measured value. FWKCS is a trademark of
Frederick W. Kantor.
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0x4B46 |
| 2 | TSize | 0x0013, 19. |
| 3 | Prefix | MD5 |
| 16 | Hash | The MD5 of the uncompressed file, low byte first. |
JAR marker, 0xCAFE
Java’s JarOutputStream adds this block to the first entry it writes, with
a data size of 0 and no data, as the first block in the extra field. It is left out if the
entry already has it. Other entries do not get it. Source: JarOutputStream.putNextEntry in
OpenJDK’s
java/util/jar/JarOutputStream.java
(tag jdk-21-ga): JAR_MAGIC = 0xCAFE (line 45); for the first entry
only (firstEntry), if the extra data is missing or hasMagic finds no
0xCAFE block, it creates a 4-byte extra field or puts 4 bytes in front of the
existing extra data, and sets the ID to 0xCAFE and the size to 0 (lines 95 to 117,
where the writes are on lines 109 and 110).
Other published layouts
From APPNOTE 4.5 and 4.6, and from Info-ZIP’s extrafld.txt. Numbers are little-endian unless the table says big-endian. Each block starts with its 2-byte ID and 2-byte size, which are left out of these tables.
OS/2 extended attributes, 0x0009
| Size | Name | Description |
|---|---|---|
| 4 | BSize | Uncompressed size of the attributes block. |
| 2 | CType | Compression method, in the local header only: 0 stored, 8 Deflate. |
| 4 | EACRC | CRC-32 of the uncompressed block, local header only. |
| varies | Data | The compressed FEA2LIST, local header only. In the central header the block is BSize alone. |
OpenVMS, 0x000C
| Size | Name | Description |
|---|---|---|
| 4 | CRC | CRC-32 of the rest of the block. |
| 2 | Tag | An OpenVMS ATR$C_ attribute code, never zero. |
| 2 | Size | The size of the value. |
| varies | Value | The attribute’s value, with no padding. Tag, size and value repeat for each attribute, and there is only one such block in a record. |
APPNOTE 4.5.6.1 makes each tag and size the ATR$C_ and
ATR$S_ constants of OpenVMS’s ATR.H, the attribute codes of
the file system’s QIO interface. PKZIP and Info-ZIP write the first eleven below
(RECATTR, UCHAR, CREDATE, REVDATE, EXPDATE, BAKDATE, ASCDATES with the revision count
only, UIC, FPRO, RPRO and JOURNAL), and some files add ADDACLENT. The numbers are those
of atrdef.h; the meanings are from the OpenVMS I/O User’s Reference Manual,
table 1.7.
| Code | Name | Size | Value |
|---|---|---|---|
| 3 | UCHAR | 4 | File characteristics, FCH$ bits: 1 no backup, 2 write back, 3 read check, 4 write check, 5 contiguous best try, 6 deaccess-locked, 7 contiguous, 11 bad ACL, 12 spool file, 13 directory, 14 bad block, 15 marked for delete, 16 no charge, 17 erase on delete, 19 shelved, 21 no move (disable movefile operations), 22 not shelvable. Bits 1 to 7 and 11 to 17 are those of a VMS fchdef header as copied into OpenBSD’s CVS (vmsmunch_private.h, which lists no bit 19, 21 or 22); bits 19, 21 and 22 are from the zipdetails project’s OpenVMS readme, which also omits “write back” and so numbers read check and write check 2 and 3, a disagreement with the header that the header settles for bits 2 to 4. |
| 4 | RECATTR | 32 | The record attribute area (FAT): record type (1: low 4 bits the format, 0 undefined, 1 fixed, 2 variable, 3 variable with fixed control, 4 stream, 5 stream LF, 6 stream CR; high 4 bits the organisation, 0 sequential, 1 relative, 2 indexed, 3 direct), record attributes (1: 1 Fortran, 2 implied, 4 print carriage control, 8 no spanning, 16 MSB record counts), record size (2), highest block (4), end-of-file block (4; both with their 16-bit halves high first), first free byte (2), bucket size (1), fixed control size (1), longest record (2), default extension (2), global buffer count (2), 8 reserved bytes, version limit (2). |
| 5, 6, 7 | FILNAM, FILTYP, FILVER | 6, 2, 2 | Name and type in Radix-50, and the version number. |
| 8 | EXPDAT | 7 | The expiration date in ASCII. |
| 9, 10 | STATBLK, HEADER | 32, 512 | The statistics block; the whole file header. |
| 11, 12 | BLOCKSIZE, USERLABEL | 2, 80 | Tape block size; the user file label. |
| 13 | ASCDATES | 35 | Revision count (2), then the revision, creation and expiration dates in ASCII. PKZIP and Info-ZIP store the count only. |
| 14, 15, 16 | ALCONTROL, ENDLBLAST, ASCNAME | 14, 4, 252 | Allocation control; the end-of-file block; the name in ASCII. |
| 17, 18, 19, 20 | CREDATE, REVDATE, EXPDATE, BAKDATE | 8 each | Creation, revision, expiration and backup dates: 64-bit VMS times, 100-nanosecond units since 17 November 1858, local time. |
| 21 | UIC | 4 | The owner: member number (2), then group (2), shown in octal as [group,member]. |
| 22 | FPRO | 2 | File protection: four 4-bit fields from the low end, system, owner, group and world. In each, bits 0 to 3 deny read, write, execute and delete. |
| 23 | RPRO | 2 | Record protection. |
| 24 to 30 | ACLEVEL, SEMASK, UIC_RO, DIRSEQ, BACKLINK, JOURNAL, HDR1_ACC | 1, 8, 4, 2, 6, 1, 1 | Access level, security mask, read-only UIC, directory sequence count, back link (the directory’s file ID), journal control flags, tape HDR1 accessibility. |
| 31 to 39 | ADDACLENT, DELACLENT, MODACLENT, FNDACLENT, FNDACLTYP, DELETEACL, READACL, ACLLENGTH, READACE | up to 512 | Access control list operations and entries. |
| 40 to 53 | RESERVED, HIGHWATER, DUMMY_0, PRIVS_USED, MATCHING_ACE, ACCESS_MODE, FILE_SPEC, CLASS_MASK, BUFFER_OFFSET, RU_ACTIVE, GRANT_ACE, NEXT_ACE, DELETE_ALL, BACKUP_DONE | varies | Mostly access-check results and controls, which a stored file does not use. |
| 54 to 73 | EFFDATE, RCDDATE, VD, PVD, SVD, VPD, VDST, BOOT, PTR, DIR, XAR, VOLUME_ID, VOLUME_FLAGS, ESCAPE_SEQUENCES, VOLUME_SET_ID, COPYRIGHT_FID, ABSTRACT_FID, BIBLIOGRAPHIC_FID, CACHE_SEQ, FILE_SYSTEM_INFO | varies | ISO 9660 dates, descriptors and volume data. |
| 74 to 82 | FILE_ATTR_CACHING_POLICY, FILE_DATA_CACHING_POLICY, CACHING_OPTIONS, POSIX_DATA, ACCDATE, ATTDATE, LENGTH_HINT, EX_RECATTR, EXTFLAGS | varies | Caching policies (1 write-through, 2 write-back, 3 default), POSIX data, access and attribute-change dates (VMS times), length hint, extended record attributes, extended flags. |
X.509 certificates: 0x0014, 0x0015, 0x0016, 0x0019
| ID | Layout |
|---|---|
0x0014 | APPNOTE 4.5.9 gives only the ID, TSize and “TData”, the data about the store; it appears in the first central directory record (in the archive extra data record when central directory encryption is used) and is ignored in any other. The inner layout is in Info-ZIP’s extrafld.txt: Version (2, 0x0001), then StoreD, a PKCS#7 store of the certificates the files may be signed with (suitable for the pbData of a CryptoAPI CRYPT_DATA_BLOB). The same file says “the SSize member above will be cbData + 6”, but its table has no SSize member, only TSize, so that sentence contradicts the table; with the table, TSize is the store’s size plus the 2 bytes of Version, and cbData + 6 would be the size of the whole block (ID, TSize, Version and store). The explorer follows the table. |
0x0015 | The certificate that signed this file. APPNOTE 4.5.10 gives only the ID, TSize and the signature data. extrafld.txt gives the inner layout, with its size called CSize (the size of Method, that is the TSize): Version (2, 0x0001), AlgID (2), IDSize (2), CertID (IDSize bytes), SigSize (2), then Sig (the signature). CertID is Size1 (4, should be IDSize − 4), Size1 again (4; “a bug in version one causes this value to appear twice”), IssSize (4), Issuer, SerSize (4) and Serial. It can repeat, once per certificate. |
0x0016 | The same as 0x0015 for the central directory, with SigSize 0 and no signature here: the signature itself is in the digital signature record after the directory. |
0x0019 | Recipient certificates: Version (2, 0x0001), then a PKCS#7 blob. It should appear only in the archive extra data record. |
Record management controls, 0x0018
A sequence of tag (2), size (2) and data (size) groups, used for record-oriented files on mainframes.
Smartcrypt, 0x0021, 0x0022, 0x0023
Each is opaque data (the policy decryption key, the key provider, and the policy key data). APPNOTE says PKWARE supplies the layouts on request, so the explorer shows them as bytes.
ZipIt Macintosh, 0x2605, 0x2705, 0x2805
| ID | Layout |
|---|---|
0x2605 | Signature (4, ZPIT), FnLen (1), FileName (FnLen, the file’s full Macintosh name), FileType (4), Creator (4). APPNOTE 4.6.4: this block MUST be present if the file is stored MacBinary-encoded and SHOULD NOT be used if it is not. |
0x2705 | Signature (4, ZPIT), FileType (4), Creator (4), then optionally fdFlags (2) and Reserved (2), big-endian, for a file. |
0x2805 | Signature (4, ZPIT), then optionally frFlags (2) and View (2), big-endian, for a folder. Bit 0 of View means the folder is shown expanded. |
Macintosh, 0x07C8, 0x334D, 0x4D63
| ID | Layout |
|---|---|
0x07C8 | Info-ZIP’s older block. Signature (4, JLEE), FInfo (16), creation date (4), modification date (4), flags (4: bit 0 means the data fork, otherwise the resource fork), directory ID (4), then optionally the volume name (28). Dates and the ID are big-endian. When this block is present, the file name has a d or r appended to say data fork or resource fork (extrafld.txt). |
0x334D | Info-ZIP’s newer block. Uncompressed size (4), flags (2: bit 0 data fork, bit 1 the name will not change, bit 2 the attributes are uncompressed, bit 3 64-bit dates, bit 4 no time zone offsets, bits 5 to 15 reserved; the flags say whether the Attribs are compressed in both headers), file type (4), creator (4). In the local header, when bit 2 is clear, method (2) and CRC-32 (4), then the Finder attributes: flags, location, folder, extended Finder data, version and access bytes, dates, optional GMT offsets, charset, full path and comment. |
0x4D63 | SmartZIP. 64 bytes: signature dZip, type and creator (4 each), Finder flags, location and folder (big-endian), two dates, scroll, script and extended flags, and a 32-byte Pascal-string name. |
Security descriptors and ACLs, 0x4453, 0x4C41, 0x5356
| ID | Layout |
|---|---|
0x4453 | Windows NT security descriptor. Uncompressed size (4), then in the local header version (1, only 0 defined), method (2), CRC-32 (4) and the compressed self-relative security descriptor. The central header has only the size. |
0x4C41 | OS/2 access control list. Uncompressed size (4), then in the local header method (2), CRC-32 (4) and the compressed text ACL. The central header has only the size. The uncompressed ACL is text: a header line ACL1:%hX,%hd and a newline, where the first number (hexadecimal) is the OS/2 ACCINFO acc_attr member and the second (decimal) is acc_count; then acc_count lines of the form %s,%hx and a newline, the user or group name (acl_ugname) and the access bits (acl_access, hexadecimal). |
0x5356 | AOS/VS (Data General), the same in both headers. Signature (4, FCI and a zero), version (1, 10 means 1.0), then the uncompressed fstat packet, which is one of four: the normal P_FSTAT structure, the directory/CPD P_FSTAT_DIR, the unit (device) P_FSTAT_UNIT or the IPC file P_FSTAT_IPC; then the raw ACL, $MXACL bytes long (extrafld.txt). |
Other systems’ attributes, 0x4154, 0x4341, 0x4704, 0x470F, 0x4854, 0x4D49, 0x6542, 0x6854, 0x7441, 0x756E
| ID | Layout |
|---|---|
0x4154 | Tandem NSK: 20 bytes of NSK attributes. |
0x4341 | Acorn SparkFS: signature (4, ARC0), load address (4, or a file type), execution address (4), attributes (4: bit 0 writable, 1 readable, 3 locked, 4 public writable, 5 public readable), and 4 reserved bytes. |
0x4704, 0x470F | VM/CMS and MVS: the uncompressed fldata_t structure. |
0x4854 | Theos, the old unofficial block (“TH”; extrafld.txt says this layout was never published, is no longer created, and UnZip reads it only when built with OLD_THEOS_EXTRA). After the ID and size: flags (2, reserved), file size (4), record length (2), key length (2), file growth (1), reserved (3). The size field (2) that follows the ID is the block’s own size, not a data field. |
0x4D49 | Info-ZIP OpenVMS (obsolete, “JM”; the same in both headers): block ID (4), flags (2: the low three bits the compression, 0 stored, 1 RLE, 2 Deflate), uncompressed size (2), reserved (4), then the compressed attributes of that one structure; several such blocks are usually present, each with a different ID. The ID is one of these unterminated strings: VFAB (struct FAB), VALL (XABALL), VFHC (XABFHC), VDAT (XABDAT), VRDT (XABRDT), VPRO (XABPRO), VKEY (XABKEY), VMSV (the VMS version, such as “V6.1”, cut at a hyphen) and VNAM (reserved). The “RLE” method replaces each zero byte by a zero bit and each non-zero byte by a 1 bit followed by the byte. |
0x6542 | BeOS: uncompressed size (4), flags (1: bit 0 means the attributes are not compressed; bits 1 to 7 are reserved, and if one is set the block is an error or unknown data), then in a local header, if compressed, method (2) and CRC-32 (4), then the attributes (big-endian): each a zero-terminated name, type (4), size (8) and data. |
0x6854 | Theos (“Th”), the same in both headers. After the ID and the block’s size (2, the size of the extra block, which is not a data field): flags (1, reserved), file size (4), file organisation (1: 0x80 library, a keyed access list of files; 0x40 directory; 0x10 stream file; 0x08 direct file; 0x04 keyed file; 0x02 indexed file; 0x0e reserved; 0x01 16-bit real mode program, obsolete; 0x21 16-bit protected mode program; 0x41 32-bit protected mode program), key length (2; the data segment size for 16-bit programs), record length (2; the text segment size for 16-bit programs), file growth factor (1), protection (1) and reserved (2). The key length and record length are for indexed and keyed files, and the record length also for direct files; the growth factor is for indexed, keyed and direct files. Protection codes (extrafld.txt; UnZip’s theos/theos.c has the struct of the old block, with size as the block size, but not this table): the user protection bits are 0x01 not readable, 0x02 not writable, 0x04 not executable and 0x08 not erasable; the other protection bits are 0x10 not readable, 0x20 not writable, 0x40 not executable (Theos before 4.0) or modified (Theos 4.x), and 0x80 not hidden. |
0x7441 | AtheOS (“At”; Syllable reuses the ID), extrafld.txt’s “very close spin-off from the BeOS e.f.”, its only differences being the ID and that numbers in the attribute data are little-endian. Local header, after ID and TSize: BSize (4, the uncompressed attribute data size), Flags (1: bit 0 set means Attribs is uncompressed, with no CType or CRC; bits 1 to 7 reserved, and if set assume an error or unknown data), then, if bit 0 is clear, CType (2: 8 Deflate or 0 stored; UnZip reads both, Info-ZIP Zip writes only Deflate) and CRC (4, of the uncompressed attributes), then Attribs. Central header: TSize 5, BSize (4, the size of the local block’s uncompressed data) and Flags (1). Attribs (after decompression) repeats: Name (zero-terminated string), Type (4, an unsigned 32-bit attribute type), Size (8, the size of the data) and Data (anything: text, flags, bitmaps). |
0x756E | ASi Unix: CRC-32 (4, of the rest), mode (2), link size or device (4), UID (2), GID (2), then the target of a symbolic link. |
SMS/QDOS, 0xFB4A (or 0xFD4A)
Local and central headers are identical (extrafld.txt). LongID (4) is QZHD or
QDOS. For QDOS a further 4 bytes (ExtraID) follow: its first three
bytes are the string 02 and a zero byte (“02\0”), and the last byte is
currently undefined. Then the 64-byte qdirect structure, the file’s
uncompressed directory information in native big-endian form: length (4), access (1), type (1),
data length (4), reserved (4), name size (2), name (36), update time (4), reference date
(4; extrafld.txt calls it the “file version number”) and backup time (4, the
archive date).
IDs without a published layout
These IDs are named by APPNOTE or used in the wild, and no public description of their
contents exists: 0x0007 AV Info, 0x0008 extended language encoding,
0x000E file stream and fork descriptors, 0x0020 timestamp record,
0x0066 compressed IBM attributes, 0x4690 POSZIP 4690,
0x4F4C Xceed original location, 0x554E Xceed Unicode,
0x9902 (seen in WinZip files),
and 0xE57A ALZip. The explorer names them and shows their bytes, and says
that no layout is published.
0x1986 Pixar USD is padding. The USDZ specification asks for every file’s
data to start on a 64-byte boundary, which a writer reaches by padding the local header’s
extra field; OpenUSD’s writer does it with a block of this ID filled with zeros. The
explorer shows it as padding.
IBM attributes, 0x0065 (appendices A and B)
The block starts with a 4-byte ID in EBCDIC, Z390 for z/OS and MVS,
I400 for OS/400, or T4MV for TargetFour, whose attributes can
come from either system, so its codes are those of appendix A or of appendix B (APPNOTE
4.5.15 and 4.5.16). Attribute records
follow, each with a 2-byte big-endian length that includes itself, a 2-byte field code
and that code’s data. Text is in EBCDIC. 0x0066 is reserved for the
same data compressed, with no layout given.
Appendix A: OS/400 (I400) field codes
| Code | Meaning |
|---|---|
4001 | Source type |
4002 | Library text description |
4003 | File text description |
4004 | Member text description |
4005 | Data type flag (F0 or 0 is PF-DTA, F1 or 1 is PF_SRC) |
4007 | Database type code (1 byte) |
4008 | Database file and field definition |
4009 | GZIP file type (2 bytes) |
400B | IFS code page (2 bytes) |
400C | IFS last status change time (4 bytes) |
400D | IFS access time (4 bytes) |
400E | IFS modification time (4 bytes) |
005C | Record length (2 bytes) |
0068 | GZIP two words (8 bytes) |
Appendix B: z/OS (Z390) field codes
| Code | Meaning |
|---|---|
0001 | File type (2) |
0002 | NonVSAM record format (1) |
0003 | Reserved |
0004 | NonVSAM block size (2, big-endian) |
0005 | Primary space allocation (3, big-endian) |
0006 | Secondary space allocation (3, big-endian) |
0007 | Space allocation type flag (1) |
0008 | Modification date (retired) |
0009 | Expiration date (retired) |
000A | PDS directory block allocation (3, big-endian binary value) |
000B | NonVSAM volume list (varies) |
000C | Unit reference (retired) |
000D, 000E, 000F | SMS management, storage and data class (8, EBCDIC) |
0010 | PDS/PDSE member information (30) |
0011 | VSAM sub-file type (2) |
0012 | VSAM LRECL (13, EBCDIC) |
0013 | VSAM cluster name (retired) |
0014 | VSAM KSDS key information (13, EBCDIC) |
0015, 0016, 0017, 0018 | VSAM average and maximum LRECL, KSDS key length and key position (5 each, EBCDIC) |
0019, 001A, 001B | VSAM data name, KSDS index name and catalog name (1 to 44, EBCDIC) |
001C, 001D, 001E | VSAM data space type, primary and secondary (9 each, EBCDIC) |
001F | VSAM data volume list (varies) |
0020 | VSAM data buffer space (8, EBCDIC) |
0021 | VSAM data CISIZE (5, EBCDIC) |
0022 | VSAM erase flag (1) |
0023, 0024 | VSAM free CI and free CA percent (3 each, EBCDIC) |
0025 | VSAM index volume list (varies) |
0026, 0027, 0028, 0029, 002A | VSAM ordered, REUSE, SPANNED, recovery and WRITECHK flags (1 each) |
002B, 002C | VSAM cluster and data SHROPTS, and index SHROPTS (3 each, EBCDIC) |
002D, 002E, 002F | VSAM index space type, primary and secondary (9 each, EBCDIC) |
0030 | VSAM index CISIZE (5, EBCDIC) |
0031, 0032, 0033, 0034 | VSAM index IMBED, ordered, REPLICATE and REUSE flags (1 each) |
0035 | VSAM index WRITECHK flag (retired) |
0036, 0037 | VSAM owner and index owner (8 each, EBCDIC) |
0038 to 0057 | Reserved |
0058 | PDS/PDSE member TTR information (6, big-endian) |
0059 | PDS first LMOD text TTR (3, big-endian) |
005A | PDS LMOD EP record number (4, big-endian) |
005B | Reserved |
005C | Maximum record length (2, big-endian) |
005D | PDSE flag (1) |
005E to 0064 | Reserved |
0065 | Last date referenced (4, packed yyyymmdd) |
0066 | Date created (4, packed yyyymmdd) |
0068 | GZIP two words (8) |
0071 | Extended NOTE location (12, big-endian) |
0072 | Archive device unit (6, EBCDIC) |
0073 | Archive first volume (6, EBCDIC) |
0074 | Archive first volume file sequence (2) |
0075 | Native I/O flags (2) |
0081 | Unix file type (1) |
0082 | Unix file format (1) |
0083 | Unix file character set tag information (4) |
0090 | ZIP environmental processing information (4) |
0091 | EAV EATTR flags (1) |
0092 | DSNTYPE flags (1) |
0093 | Total space allocation in cylinders (4, big-endian) |
009D | NonVSAM DSORG (2) |
009E | Program virtual object information (3) |
009F | Encapsulated file information (9) |
00A2 | Cluster log (4) |
00A3 | Cluster LSID length (4) |
00A4 | Cluster LSID (26, EBCDIC) |
400C, 400D, 400E | Unix file creation, access and modification times (4 each) |
4101 | IBM CMPSC compression information (varies) |
4102 | IBM CMPSC compression size (8, big-endian) |
Alignment and padding
Some formats need a member’s data to start at a multiple of some boundary, so that it can be used straight from the file, or in the case of Open Packaging so that it can grow later. Padding goes in an extra block in the local header.
Apache alignment, 0xA11E
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0xA11E |
| 2 | TSize | 2 + the padding size. |
| 2 | Alignment | Low 15 bits: the data’s minimum alignment. Bit 15: 0 the method should not change, 1 it may change when recompressing. |
| varies | Padding | Zero bytes. |
Android alignment, 0xD935
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0xD935 |
| 2 | TSize | 2 + the padding size. |
| 2 | Alignment | The multiple the data is aligned to; ApkSigner uses 4 unless told otherwise (see below). |
| varies | Padding | Zero bytes. |
Source: ApkSigner in the Android Open Source Project’s
platform/tools/apksig
(commit 184702d9d18877edf9e5296c4e191cf0aa2b5fbb of refs/heads/main):
ALIGNMENT_ZIP_EXTRA_DATA_FIELD_HEADER_ID = 0xd935 (line 79). In createExtraFieldToAlignData (lines 844 to 903) the signer drops an old
0xD935 field and any empty field with ID 0 (the older method of padding with zero bytes) from an
entry’s extra data, copies the other fields, then writes the ID, a size of 2 plus the padding size,
the alignment multiple as a 16-bit number and the padding, so that the data that follows
starts on a multiple of the alignment. Only uncompressed entries are
aligned (line 802), and without an alignment stored in the entry the multiple is 4, or the
library page alignment for names ending in .so (line 841; the value is a setting whose default is LIBRARY_PAGE_ALIGNMENT_BYTES, the number of which was not read for this page).The ZIP-writing library of Android’s platform, libziparchive
(zip_writer.cc), pads the extra field with zero bytes instead and writes no 0xD935 block.
Open Packaging growth hint, 0xA220
| Size | Name | Description |
|---|---|---|
| 2 | Tag | 0xA220 |
| 2 | TSize | The size of the signature, initial padding value and padding. |
| 2 | Signature | 0xA028. |
| 2 | PadVal | The initial padding value. APPNOTE does not say more about it. |
| varies | Padding | Filled with NUL characters. |