| 1 |
The following are the known types of zipfile extra fields as of this |
| 2 |
writing. Extra fields are documented in PKWARE's appnote.txt and are |
| 3 |
intended to allow for backward- and forward-compatible extensions to |
| 4 |
the zipfile format. Multiple extra-field types may be chained together, |
| 5 |
provided that the total length of all extra-field data is less than 64KB. |
| 6 |
(In fact, PKWARE requires that the total length of the entire file header, |
| 7 |
including timestamp, file attributes, filename, comment, extra field, etc., |
| 8 |
be no more than 64KB.) |
| 9 |
|
| 10 |
Each extra-field type (or subblock) must contain a four-byte header con- |
| 11 |
sisting of a two-byte header ID and a two-byte length (little-endian) for |
| 12 |
the remaining data in the subblock. If there are additional subblocks |
| 13 |
within the extra field, the header for each one will appear immediately |
| 14 |
following the data for the previous subblock (i.e., with no padding for |
| 15 |
alignment). |
| 16 |
|
| 17 |
All integer fields in the descriptions below are in little-endian (Intel) |
| 18 |
format unless otherwise specified. Note that "Short" means two bytes, |
| 19 |
"Long" means four bytes, and "Long-Long" means eight bytes, regardless |
| 20 |
of their native sizes. Unless specifically noted, all integer fields should |
| 21 |
be interpreted as unsigned (non-negative) numbers. |
| 22 |
|
| 23 |
Christian Spieler, 20010517 |
| 24 |
|
| 25 |
Updated to include the Unicode extra fields. Added new Unix extra field. |
| 26 |
|
| 27 |
Ed Gordon, 20060819, 20070607, 20070909, 20080426, 20080509 |
| 28 |
|
| 29 |
------------------------- |
| 30 |
|
| 31 |
Header ID's of 0 thru 31 are reserved for use by PKWARE. |
| 32 |
The remaining ID's can be used by third party vendors for |
| 33 |
proprietary usage. |
| 34 |
|
| 35 |
The current Header ID mappings defined by PKWARE are: |
| 36 |
|
| 37 |
0x0001 ZIP64 extended information extra field |
| 38 |
0x0007 AV Info |
| 39 |
0x0009 OS/2 extended attributes (also Info-ZIP) |
| 40 |
0x000a NTFS (Win9x/WinNT FileTimes) |
| 41 |
0x000c OpenVMS (also Info-ZIP) |
| 42 |
0x000d Unix |
| 43 |
0x000f Patch Descriptor |
| 44 |
0x0014 PKCS#7 Store for X.509 Certificates |
| 45 |
0x0015 X.509 Certificate ID and Signature for |
| 46 |
individual file |
| 47 |
0x0016 X.509 Certificate ID for Central Directory |
| 48 |
|
| 49 |
The Header ID mappings defined by Info-ZIP and third parties are: |
| 50 |
|
| 51 |
0x0065 IBM S/390 attributes - uncompressed |
| 52 |
0x0066 IBM S/390 attributes - compressed |
| 53 |
0x07c8 Info-ZIP Macintosh (old, J. Lee) |
| 54 |
0x2605 ZipIt Macintosh (first version) |
| 55 |
0x2705 ZipIt Macintosh v 1.3.5 and newer (w/o full filename) |
| 56 |
0x334d Info-ZIP Macintosh (new, D. Haase's 'Mac3' field ) |
| 57 |
0x4154 Tandem NSK |
| 58 |
0x4341 Acorn/SparkFS (David Pilling) |
| 59 |
0x4453 Windows NT security descriptor (binary ACL) |
| 60 |
0x4704 VM/CMS |
| 61 |
0x470f MVS |
| 62 |
0x4854 Theos, old inofficial port |
| 63 |
0x4b46 FWKCS MD5 (see below) |
| 64 |
0x4c41 OS/2 access control list (text ACL) |
| 65 |
0x4d49 Info-ZIP OpenVMS (obsolete) |
| 66 |
0x4d63 Macintosh SmartZIP, by Macro Bambini |
| 67 |
0x4f4c Xceed original location extra field |
| 68 |
0x5356 AOS/VS (binary ACL) |
| 69 |
0x5455 extended timestamp |
| 70 |
0x5855 Info-ZIP Unix (original; also OS/2, NT, etc.) |
| 71 |
0x554e Xceed unicode extra field |
| 72 |
0x6375 Info-ZIP Unicode Comment |
| 73 |
0x6542 BeOS (BeBox, PowerMac, etc.) |
| 74 |
0x6854 Theos |
| 75 |
0x7075 Info-ZIP Unicode Path |
| 76 |
0x756e ASi Unix |
| 77 |
0x7855 Info-ZIP Unix (previous new) |
| 78 |
0x7875 Info-ZIP Unix (new) |
| 79 |
0xfb4a SMS/QDOS |
| 80 |
|
| 81 |
The following are detailed descriptions of the known extra-field block types: |
| 82 |
|
| 83 |
-OS/2 Extended Attributes Extra Field: |
| 84 |
==================================== |
| 85 |
|
| 86 |
The following is the layout of the OS/2 extended attributes "extra" |
| 87 |
block. (Last Revision 19960922) |
| 88 |
|
| 89 |
Note: all fields stored in Intel low-byte/high-byte order. |
| 90 |
|
| 91 |
Local-header version: |
| 92 |
|
| 93 |
Value Size Description |
| 94 |
----- ---- ----------- |
| 95 |
(OS/2) 0x0009 Short tag for this extra block type |
| 96 |
TSize Short total data size for this block |
| 97 |
BSize Long uncompressed EA data size |
| 98 |
CType Short compression type |
| 99 |
EACRC Long CRC value for uncompressed EA data |
| 100 |
(var.) variable compressed EA data |
| 101 |
|
| 102 |
Central-header version: |
| 103 |
|
| 104 |
Value Size Description |
| 105 |
----- ---- ----------- |
| 106 |
(OS/2) 0x0009 Short tag for this extra block type |
| 107 |
TSize Short total data size for this block (4) |
| 108 |
BSize Long size of uncompressed local EA data |
| 109 |
|
| 110 |
The value of CType is interpreted according to the "compression |
| 111 |
method" section above; i.e., 0 for stored, 8 for deflated, etc. |
| 112 |
|
| 113 |
The OS/2 extended attribute structure (FEA2LIST) is compressed and |
| 114 |
then stored in its entirety within this structure. There will only |
| 115 |
ever be one block of data in the variable-length field. |
| 116 |
|
| 117 |
|
| 118 |
-OS/2 Access Control List Extra Field: |
| 119 |
==================================== |
| 120 |
|
| 121 |
The following is the layout of the OS/2 ACL extra block. |
| 122 |
(Last Revision 19960922) |
| 123 |
|
| 124 |
Local-header version: |
| 125 |
|
| 126 |
Value Size Description |
| 127 |
----- ---- ----------- |
| 128 |
(ACL) 0x4c41 Short tag for this extra block type ("AL") |
| 129 |
TSize Short total data size for this block |
| 130 |
BSize Long uncompressed ACL data size |
| 131 |
CType Short compression type |
| 132 |
EACRC Long CRC value for uncompressed ACL data |
| 133 |
(var.) variable compressed ACL data |
| 134 |
|
| 135 |
Central-header version: |
| 136 |
|
| 137 |
Value Size Description |
| 138 |
----- ---- ----------- |
| 139 |
(ACL) 0x4c41 Short tag for this extra block type ("AL") |
| 140 |
TSize Short total data size for this block (4) |
| 141 |
BSize Long size of uncompressed local ACL data |
| 142 |
|
| 143 |
The value of CType is interpreted according to the "compression |
| 144 |
method" section above; i.e., 0 for stored, 8 for deflated, etc. |
| 145 |
|
| 146 |
The uncompressed ACL data consist of a text header of the form |
| 147 |
"ACL1:%hX,%hd\n", where the first field is the OS/2 ACCINFO acc_attr |
| 148 |
member and the second is acc_count, followed by acc_count strings |
| 149 |
of the form "%s,%hx\n", where the first field is acl_ugname (user |
| 150 |
group name) and the second acl_access. This block type will be |
| 151 |
extended for other operating systems as needed. |
| 152 |
|
| 153 |
|
| 154 |
-Windows NT Security Descriptor Extra Field: |
| 155 |
========================================== |
| 156 |
|
| 157 |
The following is the layout of the NT Security Descriptor (another |
| 158 |
type of ACL) extra block. (Last Revision 19960922) |
| 159 |
|
| 160 |
Local-header version: |
| 161 |
|
| 162 |
Value Size Description |
| 163 |
----- ---- ----------- |
| 164 |
(SD) 0x4453 Short tag for this extra block type ("SD") |
| 165 |
TSize Short total data size for this block |
| 166 |
BSize Long uncompressed SD data size |
| 167 |
Version Byte version of uncompressed SD data format |
| 168 |
CType Short compression type |
| 169 |
EACRC Long CRC value for uncompressed SD data |
| 170 |
(var.) variable compressed SD data |
| 171 |
|
| 172 |
Central-header version: |
| 173 |
|
| 174 |
Value Size Description |
| 175 |
----- ---- ----------- |
| 176 |
(SD) 0x4453 Short tag for this extra block type ("SD") |
| 177 |
TSize Short total data size for this block (4) |
| 178 |
BSize Long size of uncompressed local SD data |
| 179 |
|
| 180 |
The value of CType is interpreted according to the "compression |
| 181 |
method" section above; i.e., 0 for stored, 8 for deflated, etc. |
| 182 |
Version specifies how the compressed data are to be interpreted |
| 183 |
and allows for future expansion of this extra field type. Currently |
| 184 |
only version 0 is defined. |
| 185 |
|
| 186 |
For version 0, the compressed data are to be interpreted as a single |
| 187 |
valid Windows NT SECURITY_DESCRIPTOR data structure, in self-relative |
| 188 |
format. |
| 189 |
|
| 190 |
|
| 191 |
-PKWARE Win95/WinNT Extra Field: |
| 192 |
============================== |
| 193 |
|
| 194 |
The following description covers PKWARE's "NTFS" attributes |
| 195 |
"extra" block, introduced with the release of PKZIP 2.50 for |
| 196 |
Windows. (Last Revision 20001118) |
| 197 |
|
| 198 |
(Note: At this time the Mtime, Atime and Ctime values may |
| 199 |
be used on any WIN32 system.) |
| 200 |
[Info-ZIP note: In the current implementations, this field has |
| 201 |
a fixed total data size of 32 bytes and is only stored as local |
| 202 |
extra field.] |
| 203 |
|
| 204 |
Value Size Description |
| 205 |
----- ---- ----------- |
| 206 |
(NTFS) 0x000a Short Tag for this "extra" block type |
| 207 |
TSize Short Total Data Size for this block |
| 208 |
Reserved Long for future use |
| 209 |
Tag1 Short NTFS attribute tag value #1 |
| 210 |
Size1 Short Size of attribute #1, in bytes |
| 211 |
(var.) SubSize1 Attribute #1 data |
| 212 |
. |
| 213 |
. |
| 214 |
. |
| 215 |
TagN Short NTFS attribute tag value #N |
| 216 |
SizeN Short Size of attribute #N, in bytes |
| 217 |
(var.) SubSize1 Attribute #N data |
| 218 |
|
| 219 |
For NTFS, values for Tag1 through TagN are as follows: |
| 220 |
(currently only one set of attributes is defined for NTFS) |
| 221 |
|
| 222 |
Tag Size Description |
| 223 |
----- ---- ----------- |
| 224 |
0x0001 2 bytes Tag for attribute #1 |
| 225 |
Size1 2 bytes Size of attribute #1, in bytes (24) |
| 226 |
Mtime 8 bytes 64-bit NTFS file last modification time |
| 227 |
Atime 8 bytes 64-bit NTFS file last access time |
| 228 |
Ctime 8 bytes 64-bit NTFS file creation time |
| 229 |
|
| 230 |
The total length for this block is 28 bytes, resulting in a |
| 231 |
fixed size value of 32 for the TSize field of the NTFS block. |
| 232 |
|
| 233 |
The NTFS filetimes are 64-bit unsigned integers, stored in Intel |
| 234 |
(least significant byte first) byte order. They determine the |
| 235 |
number of 1.0E-07 seconds (1/10th microseconds!) past WinNT "epoch", |
| 236 |
which is "01-Jan-1601 00:00:00 UTC". |
| 237 |
|
| 238 |
|
| 239 |
-PKWARE OpenVMS Extra Field: |
| 240 |
========================== |
| 241 |
|
| 242 |
The following is the layout of PKWARE's OpenVMS attributes "extra" |
| 243 |
block. (Last Revision 12/17/91) |
| 244 |
|
| 245 |
Note: all fields stored in Intel low-byte/high-byte order. |
| 246 |
|
| 247 |
Value Size Description |
| 248 |
----- ---- ----------- |
| 249 |
(VMS) 0x000c Short Tag for this "extra" block type |
| 250 |
TSize Short Total Data Size for this block |
| 251 |
CRC Long 32-bit CRC for remainder of the block |
| 252 |
Tag1 Short OpenVMS attribute tag value #1 |
| 253 |
Size1 Short Size of attribute #1, in bytes |
| 254 |
(var.) Size1 Attribute #1 data |
| 255 |
. |
| 256 |
. |
| 257 |
. |
| 258 |
TagN Short OpenVMS attribute tage value #N |
| 259 |
SizeN Short Size of attribute #N, in bytes |
| 260 |
(var.) SizeN Attribute #N data |
| 261 |
|
| 262 |
Rules: |
| 263 |
|
| 264 |
1. There will be one or more of attributes present, which |
| 265 |
will each be preceded by the above TagX & SizeX values. |
| 266 |
These values are identical to the ATR$C_XXXX and |
| 267 |
ATR$S_XXXX constants which are defined in ATR.H under |
| 268 |
OpenVMS C. Neither of these values will ever be zero. |
| 269 |
|
| 270 |
2. No word alignment or padding is performed. |
| 271 |
|
| 272 |
3. A well-behaved PKZIP/OpenVMS program should never produce |
| 273 |
more than one sub-block with the same TagX value. Also, |
| 274 |
there will never be more than one "extra" block of type |
| 275 |
0x000c in a particular directory record. |
| 276 |
|
| 277 |
|
| 278 |
-Info-ZIP VMS Extra Field: |
| 279 |
======================== |
| 280 |
|
| 281 |
The following is the layout of Info-ZIP's VMS attributes extra |
| 282 |
block for VAX or Alpha AXP. The local-header and central-header |
| 283 |
versions are identical. (Last Revision 19960922) |
| 284 |
|
| 285 |
Value Size Description |
| 286 |
----- ---- ----------- |
| 287 |
(VMS2) 0x4d49 Short tag for this extra block type ("JM") |
| 288 |
TSize Short total data size for this block |
| 289 |
ID Long block ID |
| 290 |
Flags Short info bytes |
| 291 |
BSize Short uncompressed block size |
| 292 |
Reserved Long (reserved) |
| 293 |
(var.) variable compressed VMS file-attributes block |
| 294 |
|
| 295 |
The block ID is one of the following unterminated strings: |
| 296 |
|
| 297 |
"VFAB" struct FAB |
| 298 |
"VALL" struct XABALL |
| 299 |
"VFHC" struct XABFHC |
| 300 |
"VDAT" struct XABDAT |
| 301 |
"VRDT" struct XABRDT |
| 302 |
"VPRO" struct XABPRO |
| 303 |
"VKEY" struct XABKEY |
| 304 |
"VMSV" version (e.g., "V6.1"; truncated at hyphen) |
| 305 |
"VNAM" reserved |
| 306 |
|
| 307 |
The lower three bits of Flags indicate the compression method. The |
| 308 |
currently defined methods are: |
| 309 |
|
| 310 |
0 stored (not compressed) |
| 311 |
1 simple "RLE" |
| 312 |
2 deflated |
| 313 |
|
| 314 |
The "RLE" method simply replaces zero-valued bytes with zero-valued |
| 315 |
bits and non-zero-valued bytes with a "1" bit followed by the byte |
| 316 |
value. |
| 317 |
|
| 318 |
The variable-length compressed data contains only the data corre- |
| 319 |
sponding to the indicated structure or string. Typically multiple |
| 320 |
VMS2 extra fields are present (each with a unique block type). |
| 321 |
|
| 322 |
|
| 323 |
-Info-ZIP Macintosh Extra Field: |
| 324 |
============================== |
| 325 |
|
| 326 |
The following is the layout of the (old) Info-ZIP resource-fork extra |
| 327 |
block for Macintosh. The local-header and central-header versions |
| 328 |
are identical. (Last Revision 19960922) |
| 329 |
|
| 330 |
Value Size Description |
| 331 |
----- ---- ----------- |
| 332 |
(Mac) 0x07c8 Short tag for this extra block type |
| 333 |
TSize Short total data size for this block |
| 334 |
"JLEE" beLong extra-field signature |
| 335 |
FInfo 16 bytes Macintosh FInfo structure |
| 336 |
CrDat beLong HParamBlockRec fileParam.ioFlCrDat |
| 337 |
MdDat beLong HParamBlockRec fileParam.ioFlMdDat |
| 338 |
Flags beLong info bits |
| 339 |
DirID beLong HParamBlockRec fileParam.ioDirID |
| 340 |
VolName 28 bytes volume name (optional) |
| 341 |
|
| 342 |
All fields but the first two are in native Macintosh format |
| 343 |
(big-endian Motorola order, not little-endian Intel). The least |
| 344 |
significant bit of Flags is 1 if the file is a data fork, 0 other- |
| 345 |
wise. In addition, if this extra field is present, the filename |
| 346 |
has an extra 'd' or 'r' appended to indicate data fork or resource |
| 347 |
fork. The 28-byte VolName field may be omitted. |
| 348 |
|
| 349 |
|
| 350 |
-ZipIt Macintosh Extra Field (long): |
| 351 |
================================== |
| 352 |
|
| 353 |
The following is the layout of the ZipIt extra block for Macintosh. |
| 354 |
The local-header and central-header versions are identical. |
| 355 |
(Last Revision 19970130) |
| 356 |
|
| 357 |
Value Size Description |
| 358 |
----- ---- ----------- |
| 359 |
(Mac2) 0x2605 Short tag for this extra block type |
| 360 |
TSize Short total data size for this block |
| 361 |
"ZPIT" beLong extra-field signature |
| 362 |
FnLen Byte length of FileName |
| 363 |
FileName variable full Macintosh filename |
| 364 |
FileType Byte[4] four-byte Mac file type string |
| 365 |
Creator Byte[4] four-byte Mac creator string |
| 366 |
|
| 367 |
|
| 368 |
-ZipIt Macintosh Extra Field (short): |
| 369 |
=================================== |
| 370 |
|
| 371 |
The following is the layout of a shortened variant of the |
| 372 |
ZipIt extra block for Macintosh (without "full name" entry). |
| 373 |
This variant is used by ZipIt 1.3.5 and newer for entries that |
| 374 |
do not need a "full Mac filename" record. |
| 375 |
The local-header and central-header versions are identical. |
| 376 |
(Last Revision 19980903) |
| 377 |
|
| 378 |
Value Size Description |
| 379 |
----- ---- ----------- |
| 380 |
(Mac2b) 0x2705 Short tag for this extra block type |
| 381 |
TSize Short total data size for this block (12) |
| 382 |
"ZPIT" beLong extra-field signature |
| 383 |
FileType Byte[4] four-byte Mac file type string |
| 384 |
Creator Byte[4] four-byte Mac creator string |
| 385 |
|
| 386 |
|
| 387 |
-Info-ZIP Macintosh Extra Field (new): |
| 388 |
==================================== |
| 389 |
|
| 390 |
The following is the layout of the (new) Info-ZIP extra |
| 391 |
block for Macintosh, designed by Dirk Haase. |
| 392 |
All values are in little-endian. |
| 393 |
(Last Revision 19981005) |
| 394 |
|
| 395 |
Local-header version: |
| 396 |
|
| 397 |
Value Size Description |
| 398 |
----- ---- ----------- |
| 399 |
(Mac3) 0x334d Short tag for this extra block type ("M3") |
| 400 |
TSize Short total data size for this block |
| 401 |
BSize Long uncompressed finder attribute data size |
| 402 |
Flags Short info bits |
| 403 |
fdType Byte[4] Type of the File (4-byte string) |
| 404 |
fdCreator Byte[4] Creator of the File (4-byte string) |
| 405 |
(CType) Short compression type |
| 406 |
(CRC) Long CRC value for uncompressed MacOS data |
| 407 |
Attribs variable finder attribute data (see below) |
| 408 |
|
| 409 |
|
| 410 |
Central-header version: |
| 411 |
|
| 412 |
Value Size Description |
| 413 |
----- ---- ----------- |
| 414 |
(Mac3) 0x334d Short tag for this extra block type ("M3") |
| 415 |
TSize Short total data size for this block |
| 416 |
BSize Long uncompressed finder attribute data size |
| 417 |
Flags Short info bits |
| 418 |
fdType Byte[4] Type of the File (4-byte string) |
| 419 |
fdCreator Byte[4] Creator of the File (4-byte string) |
| 420 |
|
| 421 |
The third bit of Flags in both headers indicates whether |
| 422 |
the LOCAL extra field is uncompressed (and therefore whether CType |
| 423 |
and CRC are omitted): |
| 424 |
|
| 425 |
Bits of the Flags: |
| 426 |
bit 0 if set, file is a data fork; otherwise unset |
| 427 |
bit 1 if set, filename will be not changed |
| 428 |
bit 2 if set, Attribs is uncompressed (no CType, CRC) |
| 429 |
bit 3 if set, date and times are in 64 bit |
| 430 |
if zero date and times are in 32 bit. |
| 431 |
bit 4 if set, timezone offsets fields for the native |
| 432 |
Mac times are omitted (UTC support deactivated) |
| 433 |
bits 5-15 reserved; |
| 434 |
|
| 435 |
|
| 436 |
Attributes: |
| 437 |
|
| 438 |
Attribs is a Mac-specific block of data in little-endian format with |
| 439 |
the following structure (if compressed, uncompress it first): |
| 440 |
|
| 441 |
Value Size Description |
| 442 |
----- ---- ----------- |
| 443 |
fdFlags Short Finder Flags |
| 444 |
fdLocation.v Short Finder Icon Location |
| 445 |
fdLocation.h Short Finder Icon Location |
| 446 |
fdFldr Short Folder containing file |
| 447 |
|
| 448 |
FXInfo 16 bytes Macintosh FXInfo structure |
| 449 |
FXInfo-Structure: |
| 450 |
fdIconID Short |
| 451 |
fdUnused[3] Short unused but reserved 6 bytes |
| 452 |
fdScript Byte Script flag and number |
| 453 |
fdXFlags Byte More flag bits |
| 454 |
fdComment Short Comment ID |
| 455 |
fdPutAway Long Home Dir ID |
| 456 |
|
| 457 |
FVersNum Byte file version number |
| 458 |
may be not used by MacOS |
| 459 |
ACUser Byte directory access rights |
| 460 |
|
| 461 |
FlCrDat ULong date and time of creation |
| 462 |
FlMdDat ULong date and time of last modification |
| 463 |
FlBkDat ULong date and time of last backup |
| 464 |
These time numbers are original Mac FileTime values (local time!). |
| 465 |
Currently, date-time width is 32-bit, but future version may |
| 466 |
support be 64-bit times (see flags) |
| 467 |
|
| 468 |
CrGMTOffs Long(signed!) difference "local Creat. time - UTC" |
| 469 |
MdGMTOffs Long(signed!) difference "local Modif. time - UTC" |
| 470 |
BkGMTOffs Long(signed!) difference "local Backup time - UTC" |
| 471 |
These "local time - UTC" differences (stored in seconds) may be |
| 472 |
used to support timestamp adjustment after inter-timezone transfer. |
| 473 |
These fields are optional; bit 4 of the flags word controls their |
| 474 |
presence. |
| 475 |
|
| 476 |
Charset Short TextEncodingBase (Charset) |
| 477 |
valid for the following two fields |
| 478 |
|
| 479 |
FullPath variable Path of the current file. |
| 480 |
Zero terminated string (C-String) |
| 481 |
Currently coded in the native Charset. |
| 482 |
|
| 483 |
Comment variable Finder Comment of the current file. |
| 484 |
Zero terminated string (C-String) |
| 485 |
Currently coded in the native Charset. |
| 486 |
|
| 487 |
|
| 488 |
-SmartZIP Macintosh Extra Field: |
| 489 |
==================================== |
| 490 |
|
| 491 |
The following is the layout of the SmartZIP extra |
| 492 |
block for Macintosh, designed by Marco Bambini. |
| 493 |
|
| 494 |
Local-header version: |
| 495 |
|
| 496 |
Value Size Description |
| 497 |
----- ---- ----------- |
| 498 |
0x4d63 Short tag for this extra block type ("cM") |
| 499 |
TSize Short total data size for this block (64) |
| 500 |
"dZip" beLong extra-field signature |
| 501 |
fdType Byte[4] Type of the File (4-byte string) |
| 502 |
fdCreator Byte[4] Creator of the File (4-byte string) |
| 503 |
fdFlags beShort Finder Flags |
| 504 |
fdLocation.v beShort Finder Icon Location |
| 505 |
fdLocation.h beShort Finder Icon Location |
| 506 |
fdFldr beShort Folder containing file |
| 507 |
CrDat beLong HParamBlockRec fileParam.ioFlCrDat |
| 508 |
MdDat beLong HParamBlockRec fileParam.ioFlMdDat |
| 509 |
frScroll.v Byte vertical pos. of folder's scroll bar |
| 510 |
fdScript Byte Script flag and number |
| 511 |
frScroll.h Byte horizontal pos. of folder's scroll bar |
| 512 |
fdXFlags Byte More flag bits |
| 513 |
FileName Byte[32] full Macintosh filename (pascal string) |
| 514 |
|
| 515 |
All fields but the first two are in native Macintosh format |
| 516 |
(big-endian Motorola order, not little-endian Intel). |
| 517 |
The extra field size is fixed to 64 bytes. |
| 518 |
The local-header and central-header versions are identical. |
| 519 |
|
| 520 |
|
| 521 |
-Acorn SparkFS Extra Field: |
| 522 |
========================= |
| 523 |
|
| 524 |
The following is the layout of David Pilling's SparkFS extra block |
| 525 |
for Acorn RISC OS. The local-header and central-header versions are |
| 526 |
identical. (Last Revision 19960922) |
| 527 |
|
| 528 |
Value Size Description |
| 529 |
----- ---- ----------- |
| 530 |
(Acorn) 0x4341 Short tag for this extra block type ("AC") |
| 531 |
TSize Short total data size for this block (20) |
| 532 |
"ARC0" Long extra-field signature |
| 533 |
LoadAddr Long load address or file type |
| 534 |
ExecAddr Long exec address |
| 535 |
Attr Long file permissions |
| 536 |
Zero Long reserved; always zero |
| 537 |
|
| 538 |
The following bits of Attr are associated with the given file |
| 539 |
permissions: |
| 540 |
|
| 541 |
bit 0 user-writable ('W') |
| 542 |
bit 1 user-readable ('R') |
| 543 |
bit 2 reserved |
| 544 |
bit 3 locked ('L') |
| 545 |
bit 4 publicly writable ('w') |
| 546 |
bit 5 publicly readable ('r') |
| 547 |
bit 6 reserved |
| 548 |
bit 7 reserved |
| 549 |
|
| 550 |
|
| 551 |
-VM/CMS Extra Field: |
| 552 |
================== |
| 553 |
|
| 554 |
The following is the layout of the file-attributes extra block for |
| 555 |
VM/CMS. The local-header and central-header versions are |
| 556 |
identical. (Last Revision 19960922) |
| 557 |
|
| 558 |
Value Size Description |
| 559 |
----- ---- ----------- |
| 560 |
(VM/CMS) 0x4704 Short tag for this extra block type |
| 561 |
TSize Short total data size for this block |
| 562 |
flData variable file attributes data |
| 563 |
|
| 564 |
flData is an uncompressed fldata_t struct. |
| 565 |
|
| 566 |
|
| 567 |
-MVS Extra Field: |
| 568 |
=============== |
| 569 |
|
| 570 |
The following is the layout of the file-attributes extra block for |
| 571 |
MVS. The local-header and central-header versions are identical. |
| 572 |
(Last Revision 19960922) |
| 573 |
|
| 574 |
Value Size Description |
| 575 |
----- ---- ----------- |
| 576 |
(MVS) 0x470f Short tag for this extra block type |
| 577 |
TSize Short total data size for this block |
| 578 |
flData variable file attributes data |
| 579 |
|
| 580 |
flData is an uncompressed fldata_t struct. |
| 581 |
|
| 582 |
|
| 583 |
-PKWARE Unix Extra Field: |
| 584 |
======================== |
| 585 |
|
| 586 |
The following is the layout of PKWARE's Unix "extra" block. |
| 587 |
It was introduced with the release of PKZIP for Unix 2.50. |
| 588 |
Note: all fields are stored in Intel low-byte/high-byte order. |
| 589 |
(Last Revision 19980901) |
| 590 |
|
| 591 |
This field has a minimum data size of 12 bytes and is only stored |
| 592 |
as local extra field. |
| 593 |
|
| 594 |
Value Size Description |
| 595 |
----- ---- ----------- |
| 596 |
(Unix0) 0x000d Short Tag for this "extra" block type |
| 597 |
TSize Short Total Data Size for this block |
| 598 |
AcTime Long time of last access (UTC/GMT) |
| 599 |
ModTime Long time of last modification (UTC/GMT) |
| 600 |
UID Short Unix user ID |
| 601 |
GID Short Unix group ID |
| 602 |
(var) variable Variable length data field |
| 603 |
|
| 604 |
The variable length data field will contain file type |
| 605 |
specific data. Currently the only values allowed are |
| 606 |
the original "linked to" file names for hard or symbolic |
| 607 |
links, and the major and minor device node numbers for |
| 608 |
character and block device nodes. Since device nodes |
| 609 |
cannot be either symbolic or hard links, only one set of |
| 610 |
variable length data is stored. Link files will have the |
| 611 |
name of the original file stored. This name is NOT NULL |
| 612 |
terminated. Its size can be determined by checking TSize - |
| 613 |
12. Device entries will have eight bytes stored as two 4 |
| 614 |
byte entries (in little-endian format). The first entry |
| 615 |
will be the major device number, and the second the minor |
| 616 |
device number. |
| 617 |
|
| 618 |
[Info-ZIP note: The fixed part of this field has the same layout as |
| 619 |
Info-ZIP's abandoned "Unix1 timestamps & owner ID info" extra field; |
| 620 |
only the two tag bytes are different.] |
| 621 |
|
| 622 |
|
| 623 |
-PATCH Descriptor Extra Field: |
| 624 |
============================ |
| 625 |
|
| 626 |
The following is the layout of the Patch Descriptor "extra" |
| 627 |
block. |
| 628 |
|
| 629 |
Note: all fields stored in Intel low-byte/high-byte order. |
| 630 |
|
| 631 |
Value Size Description |
| 632 |
----- ---- ----------- |
| 633 |
(Patch) 0x000f Short Tag for this "extra" block type |
| 634 |
TSize Short Size of the total "extra" block |
| 635 |
Version Short Version of the descriptor |
| 636 |
Flags Long Actions and reactions (see below) |
| 637 |
OldSize Long Size of the file about to be patched |
| 638 |
OldCRC Long 32-bit CRC of the file about to be patched |
| 639 |
NewSize Long Size of the resulting file |
| 640 |
NewCRC Long 32-bit CRC of the resulting file |
| 641 |
|
| 642 |
|
| 643 |
Actions and reactions |
| 644 |
|
| 645 |
Bits Description |
| 646 |
---- ---------------- |
| 647 |
0 Use for autodetection |
| 648 |
1 Treat as selfpatch |
| 649 |
2-3 RESERVED |
| 650 |
4-5 Action (see below) |
| 651 |
6-7 RESERVED |
| 652 |
8-9 Reaction (see below) to absent file |
| 653 |
10-11 Reaction (see below) to newer file |
| 654 |
12-13 Reaction (see below) to unknown file |
| 655 |
14-15 RESERVED |
| 656 |
16-31 RESERVED |
| 657 |
|
| 658 |
Actions |
| 659 |
|
| 660 |
Action Value |
| 661 |
------ ----- |
| 662 |
none 0 |
| 663 |
add 1 |
| 664 |
delete 2 |
| 665 |
patch 3 |
| 666 |
|
| 667 |
Reactions |
| 668 |
|
| 669 |
Reaction Value |
| 670 |
-------- ----- |
| 671 |
ask 0 |
| 672 |
skip 1 |
| 673 |
ignore 2 |
| 674 |
fail 3 |
| 675 |
|
| 676 |
|
| 677 |
-PKCS#7 Store for X.509 Certificates: |
| 678 |
=================================== |
| 679 |
|
| 680 |
This field is contains the information about each |
| 681 |
certificate a file is signed with. This field should only |
| 682 |
appear in the first central directory record, and will be |
| 683 |
ignored in any other record. |
| 684 |
|
| 685 |
Note: all fields stored in Intel low-byte/high-byte order. |
| 686 |
|
| 687 |
Value Size Description |
| 688 |
----- ---- ----------- |
| 689 |
(Store) 0x0014 2 bytes Tag for this "extra" block type |
| 690 |
SSize 2 bytes Size of the store data |
| 691 |
SData (variable) Data about the store |
| 692 |
|
| 693 |
SData |
| 694 |
Value Size Description |
| 695 |
----- ---- ----------- |
| 696 |
Version 2 bytes Version number, 0x0001 for now |
| 697 |
StoreD (variable) Actual store data |
| 698 |
|
| 699 |
The StoreD member is suitable for passing as the pbData |
| 700 |
member of a CRYPT_DATA_BLOB to the CertOpenStore() function |
| 701 |
in Microsoft's CryptoAPI. The SSize member above will be |
| 702 |
cbData + 6, where cbData is the cbData member of the same |
| 703 |
CRYPT_DATA_BLOB. The encoding type to pass to |
| 704 |
CertOpenStore() should be |
| 705 |
PKCS_7_ANS_ENCODING | X509_ASN_ENCODING. |
| 706 |
|
| 707 |
|
| 708 |
-X.509 Certificate ID and Signature for individual file: |
| 709 |
====================================================== |
| 710 |
|
| 711 |
This field contains the information about which certificate |
| 712 |
in the PKCS#7 Store was used to sign the particular file. |
| 713 |
It also contains the signature data. This field can appear |
| 714 |
multiple times, but can only appear once per certificate. |
| 715 |
|
| 716 |
Note: all fields stored in Intel low-byte/high-byte order. |
| 717 |
|
| 718 |
Value Size Description |
| 719 |
----- ---- ----------- |
| 720 |
(CID) 0x0015 2 bytes Tag for this "extra" block type |
| 721 |
CSize 2 bytes Size of Method |
| 722 |
Method (variable) |
| 723 |
|
| 724 |
Method |
| 725 |
Value Size Description |
| 726 |
----- ---- ----------- |
| 727 |
Version 2 bytes Version number, for now 0x0001 |
| 728 |
AlgID 2 bytes Algorithm ID used for signing |
| 729 |
IDSize 2 bytes Size of Certificate ID data |
| 730 |
CertID (variable) Certificate ID data |
| 731 |
SigSize 2 bytes Size of Signature data |
| 732 |
Sig (variable) Signature data |
| 733 |
|
| 734 |
CertID |
| 735 |
Value Size Description |
| 736 |
----- ---- ----------- |
| 737 |
Size1 4 bytes Size of CertID, should be (IDSize - 4) |
| 738 |
Size1 4 bytes A bug in version one causes this value |
| 739 |
to appear twice. |
| 740 |
IssSize 4 bytes Issuer data size |
| 741 |
Issuer (variable) Issuer data |
| 742 |
SerSize 4 bytes Serial Number size |
| 743 |
Serial (variable) Serial Number data |
| 744 |
|
| 745 |
The Issuer and IssSize members are suitable for creating a |
| 746 |
CRYPT_DATA_BLOB to be the Issuer member of a CERT_INFO |
| 747 |
struct. The Serial and SerSize members would be the |
| 748 |
SerialNumber member of the same CERT_INFO struct. This |
| 749 |
struct would be used to find the certificate in the store |
| 750 |
the file was signed with. Those structures are from the MS |
| 751 |
CryptoAPI. |
| 752 |
|
| 753 |
Sig and SigSize are the actual signature data and size |
| 754 |
generated by signing the file with the MS CryptoAPI using a |
| 755 |
hash created with the given AlgID. |
| 756 |
|
| 757 |
|
| 758 |
-X.509 Certificate ID and Signature for central directory: |
| 759 |
======================================================== |
| 760 |
|
| 761 |
This field contains the information about which certificate |
| 762 |
in the PKCS#7 Store was used to sign the central directory. |
| 763 |
It should only appear with the first central directory |
| 764 |
record, along with the store. The data structure is the |
| 765 |
same as the CID, except that SigSize will be 0, and there |
| 766 |
will be no Sig member. |
| 767 |
|
| 768 |
This field is also kept after the last central directory |
| 769 |
record, as the signature data (ID 0x05054b50, it looks like |
| 770 |
a central directory record of a different type). This |
| 771 |
second copy of the data is the Signature Data member of the |
| 772 |
record, and will have a SigSize that is non-zero, and will |
| 773 |
have Sig data. |
| 774 |
|
| 775 |
Note: all fields stored in Intel low-byte/high-byte order. |
| 776 |
|
| 777 |
Value Size Description |
| 778 |
----- ---- ----------- |
| 779 |
(CDID) 0x0016 2 bytes Tag for this "extra" block type |
| 780 |
CSize 2 bytes Size of Method |
| 781 |
Method (variable) |
| 782 |
|
| 783 |
|
| 784 |
-ZIP64 Extended Information Extra Field: |
| 785 |
====================================== |
| 786 |
|
| 787 |
The following is the layout of the ZIP64 extended |
| 788 |
information "extra" block. If one of the size or |
| 789 |
offset fields in the Local or Central directory |
| 790 |
record is too small to hold the required data, |
| 791 |
a ZIP64 extended information record is created. |
| 792 |
The order of the fields in the ZIP64 extended |
| 793 |
information record is fixed, but the fields will |
| 794 |
only appear if the corresponding Local or Central |
| 795 |
directory record field is set to 0xFFFF or 0xFFFFFFFF. |
| 796 |
|
| 797 |
Note: all fields stored in Intel low-byte/high-byte order. |
| 798 |
|
| 799 |
Value Size Description |
| 800 |
----- ---- ----------- |
| 801 |
(ZIP64) 0x0001 2 bytes Tag for this "extra" block type |
| 802 |
Size 2 bytes Size of this "extra" block |
| 803 |
Original |
| 804 |
Size 8 bytes Original uncompresseed file size |
| 805 |
Compressed |
| 806 |
Size 8 bytes Size of compressed data |
| 807 |
Relative Header |
| 808 |
Offset 8 bytes Offset of local header record |
| 809 |
Disk Start |
| 810 |
Number 4 bytes Number of the disk on which |
| 811 |
this file starts |
| 812 |
|
| 813 |
This entry in the Local header must include BOTH original |
| 814 |
and compressed file sizes. |
| 815 |
|
| 816 |
|
| 817 |
-Extended Timestamp Extra Field: |
| 818 |
============================== |
| 819 |
|
| 820 |
The following is the layout of the extended-timestamp extra block. |
| 821 |
(Last Revision 19970118) |
| 822 |
|
| 823 |
Local-header version: |
| 824 |
|
| 825 |
Value Size Description |
| 826 |
----- ---- ----------- |
| 827 |
(time) 0x5455 Short tag for this extra block type ("UT") |
| 828 |
TSize Short total data size for this block |
| 829 |
Flags Byte info bits |
| 830 |
(ModTime) Long time of last modification (UTC/GMT) |
| 831 |
(AcTime) Long time of last access (UTC/GMT) |
| 832 |
(CrTime) Long time of original creation (UTC/GMT) |
| 833 |
|
| 834 |
Central-header version: |
| 835 |
|
| 836 |
Value Size Description |
| 837 |
----- ---- ----------- |
| 838 |
(time) 0x5455 Short tag for this extra block type ("UT") |
| 839 |
TSize Short total data size for this block |
| 840 |
Flags Byte info bits (refers to local header!) |
| 841 |
(ModTime) Long time of last modification (UTC/GMT) |
| 842 |
|
| 843 |
The central-header extra field contains the modification time only, |
| 844 |
or no timestamp at all. TSize is used to flag its presence or |
| 845 |
absence. But note: |
| 846 |
|
| 847 |
If "Flags" indicates that Modtime is present in the local header |
| 848 |
field, it MUST be present in the central header field, too! |
| 849 |
This correspondence is required because the modification time |
| 850 |
value may be used to support trans-timezone freshening and |
| 851 |
updating operations with zip archives. |
| 852 |
|
| 853 |
The time values are in standard Unix signed-long format, indicating |
| 854 |
the number of seconds since 1 January 1970 00:00:00. The times |
| 855 |
are relative to Coordinated Universal Time (UTC), also sometimes |
| 856 |
referred to as Greenwich Mean Time (GMT). To convert to local time, |
| 857 |
the software must know the local timezone offset from UTC/GMT. |
| 858 |
|
| 859 |
The lower three bits of Flags in both headers indicate which time- |
| 860 |
stamps are present in the LOCAL extra field: |
| 861 |
|
| 862 |
bit 0 if set, modification time is present |
| 863 |
bit 1 if set, access time is present |
| 864 |
bit 2 if set, creation time is present |
| 865 |
bits 3-7 reserved for additional timestamps; not set |
| 866 |
|
| 867 |
Those times that are present will appear in the order indicated, but |
| 868 |
any combination of times may be omitted. (Creation time may be |
| 869 |
present without access time, for example.) TSize should equal |
| 870 |
(1 + 4*(number of set bits in Flags)), as the block is currently |
| 871 |
defined. Other timestamps may be added in the future. |
| 872 |
|
| 873 |
|
| 874 |
-Info-ZIP Unix Extra Field (type 1): |
| 875 |
================================== |
| 876 |
|
| 877 |
The following is the layout of the old Info-ZIP extra block for |
| 878 |
Unix. It has been replaced by the extended-timestamp extra block |
| 879 |
(0x5455) and the Unix type 2 extra block (0x7855). |
| 880 |
(Last Revision 19970118) |
| 881 |
|
| 882 |
Local-header version: |
| 883 |
|
| 884 |
Value Size Description |
| 885 |
----- ---- ----------- |
| 886 |
(Unix1) 0x5855 Short tag for this extra block type ("UX") |
| 887 |
TSize Short total data size for this block |
| 888 |
AcTime Long time of last access (UTC/GMT) |
| 889 |
ModTime Long time of last modification (UTC/GMT) |
| 890 |
UID Short Unix user ID (optional) |
| 891 |
GID Short Unix group ID (optional) |
| 892 |
|
| 893 |
Central-header version: |
| 894 |
|
| 895 |
Value Size Description |
| 896 |
----- ---- ----------- |
| 897 |
(Unix1) 0x5855 Short tag for this extra block type ("UX") |
| 898 |
TSize Short total data size for this block |
| 899 |
AcTime Long time of last access (GMT/UTC) |
| 900 |
ModTime Long time of last modification (GMT/UTC) |
| 901 |
|
| 902 |
The file access and modification times are in standard Unix signed- |
| 903 |
long format, indicating the number of seconds since 1 January 1970 |
| 904 |
00:00:00. The times are relative to Coordinated Universal Time |
| 905 |
(UTC), also sometimes referred to as Greenwich Mean Time (GMT). To |
| 906 |
convert to local time, the software must know the local timezone |
| 907 |
offset from UTC/GMT. The modification time may be used by non-Unix |
| 908 |
systems to support inter-timezone freshening and updating of zip |
| 909 |
archives. |
| 910 |
|
| 911 |
The local-header extra block may optionally contain UID and GID |
| 912 |
info for the file. The local-header TSize value is the only |
| 913 |
indication of this. Note that Unix UIDs and GIDs are usually |
| 914 |
specific to a particular machine, and they generally require root |
| 915 |
access to restore. |
| 916 |
|
| 917 |
This extra field type is obsolete, but it has been in use since |
| 918 |
mid-1994. Therefore future archiving software should continue to |
| 919 |
support it. Some guidelines: |
| 920 |
|
| 921 |
An archive member should either contain the old "Unix1" |
| 922 |
extra field block or the new extra field types "time" and/or |
| 923 |
"Unix2". |
| 924 |
|
| 925 |
If both the old "Unix1" block type and one or both of the new |
| 926 |
block types "time" and "Unix2" are found, the "Unix1" block |
| 927 |
should be considered invalid and ignored. |
| 928 |
|
| 929 |
Unarchiving software should recognize both old and new extra |
| 930 |
field block types, but the info from new types overrides the |
| 931 |
old "Unix1" field. |
| 932 |
|
| 933 |
Archiving software should recognize "Unix1" extra fields for |
| 934 |
timestamp comparison but never create it for updated, freshened |
| 935 |
or new archive members. When copying existing members to a new |
| 936 |
archive, any "Unix1" extra field blocks should be converted to |
| 937 |
the new "time" and/or "Unix2" types. |
| 938 |
|
| 939 |
|
| 940 |
-Info-ZIP Unix Extra Field (type 2): |
| 941 |
================================== |
| 942 |
|
| 943 |
The following is the layout of the new Info-ZIP extra block for |
| 944 |
Unix. (Last Revision 19960922) |
| 945 |
|
| 946 |
Local-header version: |
| 947 |
|
| 948 |
Value Size Description |
| 949 |
----- ---- ----------- |
| 950 |
(Unix2) 0x7855 Short tag for this extra block type ("Ux") |
| 951 |
TSize Short total data size for this block (4) |
| 952 |
UID Short Unix user ID |
| 953 |
GID Short Unix group ID |
| 954 |
|
| 955 |
Central-header version: |
| 956 |
|
| 957 |
Value Size Description |
| 958 |
----- ---- ----------- |
| 959 |
(Unix2) 0x7855 Short tag for this extra block type ("Ux") |
| 960 |
TSize Short total data size for this block (0) |
| 961 |
|
| 962 |
The data size of the central-header version is zero; it is used |
| 963 |
solely as a flag that UID/GID info is present in the local-header |
| 964 |
extra field. If additional fields are ever added to the local |
| 965 |
version, the central version may be extended to indicate this. |
| 966 |
|
| 967 |
Note that Unix UIDs and GIDs are usually specific to a particular |
| 968 |
machine, and they generally require root access to restore. |
| 969 |
|
| 970 |
|
| 971 |
-ASi Unix Extra Field: |
| 972 |
==================== |
| 973 |
|
| 974 |
The following is the layout of the ASi extra block for Unix. The |
| 975 |
local-header and central-header versions are identical. |
| 976 |
(Last Revision 19960916) |
| 977 |
|
| 978 |
Value Size Description |
| 979 |
----- ---- ----------- |
| 980 |
(Unix3) 0x756e Short tag for this extra block type ("nu") |
| 981 |
TSize Short total data size for this block |
| 982 |
CRC Long CRC-32 of the remaining data |
| 983 |
Mode Short file permissions |
| 984 |
SizDev Long symlink'd size OR major/minor dev num |
| 985 |
UID Short user ID |
| 986 |
GID Short group ID |
| 987 |
(var.) variable symbolic link filename |
| 988 |
|
| 989 |
Mode is the standard Unix st_mode field from struct stat, containing |
| 990 |
user/group/other permissions, setuid/setgid and symlink info, etc. |
| 991 |
|
| 992 |
If Mode indicates that this file is a symbolic link, SizDev is the |
| 993 |
size of the file to which the link points. Otherwise, if the file |
| 994 |
is a device, SizDev contains the standard Unix st_rdev field from |
| 995 |
struct stat (includes the major and minor numbers of the device). |
| 996 |
SizDev is undefined in other cases. |
| 997 |
|
| 998 |
If Mode indicates that the file is a symbolic link, the final field |
| 999 |
will be the name of the file to which the link points. The file- |
| 1000 |
name length can be inferred from TSize. |
| 1001 |
|
| 1002 |
[Note that TSize may incorrectly refer to the data size not counting |
| 1003 |
the CRC; i.e., it may be four bytes too small.] |
| 1004 |
|
| 1005 |
|
| 1006 |
-BeOS Extra Field: |
| 1007 |
================ |
| 1008 |
|
| 1009 |
The following is the layout of the file-attributes extra block for |
| 1010 |
BeOS. (Last Revision 19970531) |
| 1011 |
|
| 1012 |
Local-header version: |
| 1013 |
|
| 1014 |
Value Size Description |
| 1015 |
----- ---- ----------- |
| 1016 |
(BeOS) 0x6542 Short tag for this extra block type ("Be") |
| 1017 |
TSize Short total data size for this block |
| 1018 |
BSize Long uncompressed file attribute data size |
| 1019 |
Flags Byte info bits |
| 1020 |
(CType) Short compression type |
| 1021 |
(CRC) Long CRC value for uncompressed file attribs |
| 1022 |
Attribs variable file attribute data |
| 1023 |
|
| 1024 |
Central-header version: |
| 1025 |
|
| 1026 |
Value Size Description |
| 1027 |
----- ---- ----------- |
| 1028 |
(BeOS) 0x6542 Short tag for this extra block type ("Be") |
| 1029 |
TSize Short total data size for this block (5) |
| 1030 |
BSize Long size of uncompr. local EF block data |
| 1031 |
Flags Byte info bits |
| 1032 |
|
| 1033 |
The least significant bit of Flags in both headers indicates whether |
| 1034 |
the LOCAL extra field is uncompressed (and therefore whether CType |
| 1035 |
and CRC are omitted): |
| 1036 |
|
| 1037 |
bit 0 if set, Attribs is uncompressed (no CType, CRC) |
| 1038 |
bits 1-7 reserved; if set, assume error or unknown data |
| 1039 |
|
| 1040 |
Currently the only supported compression types are deflated (type 8) |
| 1041 |
and stored (type 0); the latter is not used by Info-ZIP's Zip but is |
| 1042 |
supported by UnZip. |
| 1043 |
|
| 1044 |
Attribs is a BeOS-specific block of data in big-endian format with |
| 1045 |
the following structure (if compressed, uncompress it first): |
| 1046 |
|
| 1047 |
Value Size Description |
| 1048 |
----- ---- ----------- |
| 1049 |
Name variable attribute name (null-terminated string) |
| 1050 |
Type Long attribute type (32-bit unsigned integer) |
| 1051 |
Size Long Long data size for this sub-block (64 bits) |
| 1052 |
Data variable attribute data |
| 1053 |
|
| 1054 |
The attribute structure is repeated for every attribute. The Data |
| 1055 |
field may contain anything--text, flags, bitmaps, etc. |
| 1056 |
|
| 1057 |
|
| 1058 |
-SMS/QDOS Extra Field: |
| 1059 |
==================== |
| 1060 |
|
| 1061 |
The following is the layout of the file-attributes extra block for |
| 1062 |
SMS/QDOS. The local-header and central-header versions are identical. |
| 1063 |
(Last Revision 19960929) |
| 1064 |
|
| 1065 |
Value Size Description |
| 1066 |
----- ---- ----------- |
| 1067 |
(QDOS) 0xfb4a Short tag for this extra block type |
| 1068 |
TSize Short total data size for this block |
| 1069 |
LongID Long extra-field signature |
| 1070 |
(ExtraID) Long additional signature/flag bytes |
| 1071 |
QDirect 64 bytes qdirect structure |
| 1072 |
|
| 1073 |
LongID may be "QZHD" or "QDOS". In the latter case, ExtraID will |
| 1074 |
be present. Its first three bytes are "02\0"; the last byte is |
| 1075 |
currently undefined. |
| 1076 |
|
| 1077 |
QDirect contains the file's uncompressed directory info (qdirect |
| 1078 |
struct). Its elements are in native (big-endian) format: |
| 1079 |
|
| 1080 |
d_length beLong file length |
| 1081 |
d_access byte file access type |
| 1082 |
d_type byte file type |
| 1083 |
d_datalen beLong data length |
| 1084 |
d_reserved beLong unused |
| 1085 |
d_szname beShort size of filename |
| 1086 |
d_name 36 bytes filename |
| 1087 |
d_update beLong time of last update |
| 1088 |
d_refdate beLong file version number |
| 1089 |
d_backup beLong time of last backup (archive date) |
| 1090 |
|
| 1091 |
|
| 1092 |
-AOS/VS Extra Field: |
| 1093 |
================== |
| 1094 |
|
| 1095 |
The following is the layout of the extra block for Data General |
| 1096 |
AOS/VS. The local-header and central-header versions are identical. |
| 1097 |
(Last Revision 19961125) |
| 1098 |
|
| 1099 |
Value Size Description |
| 1100 |
----- ---- ----------- |
| 1101 |
(AOSVS) 0x5356 Short tag for this extra block type ("VS") |
| 1102 |
TSize Short total data size for this block |
| 1103 |
"FCI\0" Long extra-field signature |
| 1104 |
Version Byte version of AOS/VS extra block (10 = 1.0) |
| 1105 |
Fstat variable fstat packet |
| 1106 |
AclBuf variable raw ACL data ($MXACL bytes) |
| 1107 |
|
| 1108 |
Fstat contains the file's uncompressed fstat packet, which is one of |
| 1109 |
the following: |
| 1110 |
|
| 1111 |
normal fstat packet (P_FSTAT struct) |
| 1112 |
DIR/CPD fstat packet (P_FSTAT_DIR struct) |
| 1113 |
unit (device) fstat packet (P_FSTAT_UNIT struct) |
| 1114 |
IPC file fstat packet (P_FSTAT_IPC struct) |
| 1115 |
|
| 1116 |
AclBuf contains the raw ACL data; its length is $MXACL. |
| 1117 |
|
| 1118 |
|
| 1119 |
-Tandem NSK Extra Field: |
| 1120 |
====================== |
| 1121 |
|
| 1122 |
The following is the layout of the file-attributes extra block for |
| 1123 |
Tandem NSK. The local-header and central-header versions are |
| 1124 |
identical. (Last Revision 19981221) |
| 1125 |
|
| 1126 |
Value Size Description |
| 1127 |
----- ---- ----------- |
| 1128 |
(TA) 0x4154 Short tag for this extra block type ("TA") |
| 1129 |
TSize Short total data size for this block (20) |
| 1130 |
NSKattrs 20 Bytes NSK attributes |
| 1131 |
|
| 1132 |
|
| 1133 |
-THEOS Extra Field: |
| 1134 |
================= |
| 1135 |
|
| 1136 |
The following is the layout of the file-attributes extra block for |
| 1137 |
Theos. The local-header and central-header versions are identical. |
| 1138 |
(Last Revision 19990206) |
| 1139 |
|
| 1140 |
Value Size Description |
| 1141 |
----- ---- ----------- |
| 1142 |
(Theos) 0x6854 Short 'Th' signature |
| 1143 |
size Short size of extra block |
| 1144 |
flags Byte reserved for future use |
| 1145 |
filesize Long file size |
| 1146 |
fileorg Byte type of file (see below) |
| 1147 |
keylen Short key length for indexed and keyed files, |
| 1148 |
data segment size for 16 bits programs |
| 1149 |
reclen Short record length for indexed,keyed and direct, |
| 1150 |
text segment size for 16 bits programs |
| 1151 |
filegrow Byte growing factor for indexed,keyed and direct |
| 1152 |
protect Byte protections (see below) |
| 1153 |
reserved Short reserved for future use |
| 1154 |
|
| 1155 |
File types |
| 1156 |
========== |
| 1157 |
|
| 1158 |
0x80 library (keyed access list of files) |
| 1159 |
0x40 directory |
| 1160 |
0x10 stream file |
| 1161 |
0x08 direct file |
| 1162 |
0x04 keyed file |
| 1163 |
0x02 indexed file |
| 1164 |
0x0e reserved |
| 1165 |
0x01 16 bits real mode program (obsolete) |
| 1166 |
0x21 16 bits protected mode program |
| 1167 |
0x41 32 bits protected mode program |
| 1168 |
|
| 1169 |
Protection codes |
| 1170 |
================ |
| 1171 |
|
| 1172 |
User protection |
| 1173 |
--------------- |
| 1174 |
0x01 non readable |
| 1175 |
0x02 non writable |
| 1176 |
0x04 non executable |
| 1177 |
0x08 non erasable |
| 1178 |
|
| 1179 |
Other protection |
| 1180 |
---------------- |
| 1181 |
0x10 non readable |
| 1182 |
0x20 non writable |
| 1183 |
0x40 non executable Theos before 4.0 |
| 1184 |
0x40 modified Theos 4.x |
| 1185 |
0x80 not hidden |
| 1186 |
|
| 1187 |
|
| 1188 |
-THEOS old inofficial Extra Field: |
| 1189 |
================================ |
| 1190 |
|
| 1191 |
The following is the layout of an inoffical former version of a |
| 1192 |
Theos file-attributes extra blocks. This layout was never published |
| 1193 |
and is no longer created. However, UnZip can optionally support it |
| 1194 |
when compiling with the option flag OLD_THEOS_EXTRA defined. |
| 1195 |
Both the local-header and central-header versions are identical. |
| 1196 |
(Last Revision 19990206) |
| 1197 |
|
| 1198 |
Value Size Description |
| 1199 |
----- ---- ----------- |
| 1200 |
(THS0) 0x4854 Short 'TH' signature |
| 1201 |
size Short size of extra block |
| 1202 |
flags Short reserved for future use |
| 1203 |
filesize Long file size |
| 1204 |
reclen Short record length for indexed,keyed and direct, |
| 1205 |
text segment size for 16 bits programs |
| 1206 |
keylen Short key length for indexed and keyed files, |
| 1207 |
data segment size for 16 bits programs |
| 1208 |
filegrow Byte growing factor for indexed,keyed and direct |
| 1209 |
reserved 3 Bytes reserved for future use |
| 1210 |
|
| 1211 |
|
| 1212 |
-FWKCS MD5 Extra Field: |
| 1213 |
===================== |
| 1214 |
|
| 1215 |
The FWKCS Contents_Signature System, used in automatically |
| 1216 |
identifying files independent of filename, optionally adds |
| 1217 |
and uses an extra field to support the rapid creation of |
| 1218 |
an enhanced contents_signature. |
| 1219 |
There is no local-header version; the following applies |
| 1220 |
only to the central header. (Last Revision 19961207) |
| 1221 |
|
| 1222 |
Central-header version: |
| 1223 |
|
| 1224 |
Value Size Description |
| 1225 |
----- ---- ----------- |
| 1226 |
(MD5) 0x4b46 Short tag for this extra block type ("FK") |
| 1227 |
TSize Short total data size for this block (19) |
| 1228 |
"MD5" 3 bytes extra-field signature |
| 1229 |
MD5hash 16 bytes 128-bit MD5 hash of uncompressed data |
| 1230 |
(low byte first) |
| 1231 |
|
| 1232 |
When FWKCS revises a .ZIP file central directory to add |
| 1233 |
this extra field for a file, it also replaces the |
| 1234 |
central directory entry for that file's uncompressed |
| 1235 |
file length with a measured value. |
| 1236 |
|
| 1237 |
FWKCS provides an option to strip this extra field, if |
| 1238 |
present, from a .ZIP file central directory. In adding |
| 1239 |
this extra field, FWKCS preserves .ZIP file Authenticity |
| 1240 |
Verification; if stripping this extra field, FWKCS |
| 1241 |
preserves all versions of AV through PKZIP version 2.04g. |
| 1242 |
|
| 1243 |
FWKCS, and FWKCS Contents_Signature System, are |
| 1244 |
trademarks of Frederick W. Kantor. |
| 1245 |
|
| 1246 |
(1) R. Rivest, RFC1321.TXT, MIT Laboratory for Computer |
| 1247 |
Science and RSA Data Security, Inc., April 1992. |
| 1248 |
ll.76-77: "The MD5 algorithm is being placed in the |
| 1249 |
public domain for review and possible adoption as a |
| 1250 |
standard." |
| 1251 |
|
| 1252 |
|
| 1253 |
-Info-ZIP Unicode Path Extra Field: |
| 1254 |
================================= |
| 1255 |
|
| 1256 |
Stores the UTF-8 version of the entry path as stored in the |
| 1257 |
local header and central directory header. |
| 1258 |
(Last Revision 20070912) |
| 1259 |
|
| 1260 |
Value Size Description |
| 1261 |
----- ---- ----------- |
| 1262 |
(UPath) 0x7075 Short tag for this extra block type ("up") |
| 1263 |
TSize Short total data size for this block |
| 1264 |
Version 1 byte version of this extra field, currently 1 |
| 1265 |
NameCRC32 4 bytes File Name Field CRC32 Checksum |
| 1266 |
UnicodeName Variable UTF-8 version of the entry File Name |
| 1267 |
|
| 1268 |
Currently Version is set to the number 1. If there is a need |
| 1269 |
to change this field, the version will be incremented. Changes |
| 1270 |
may not be backward compatible so this extra field should not be |
| 1271 |
used if the version is not recognized. |
| 1272 |
|
| 1273 |
The NameCRC32 is the standard zip CRC32 checksum of the File Name |
| 1274 |
field in the header. This is used to verify that the header |
| 1275 |
File Name field has not changed since the Unicode Path extra field |
| 1276 |
was created. This can happen if a utility renames the entry but |
| 1277 |
does not update the UTF-8 path extra field. If the CRC check fails, |
| 1278 |
this UTF-8 Path Extra Field should be ignored and the File Name field |
| 1279 |
in the header used instead. |
| 1280 |
|
| 1281 |
The UnicodeName is the UTF-8 version of the contents of the File Name |
| 1282 |
field in the header. As UnicodeName is defined to be UTF-8, no UTF-8 |
| 1283 |
byte order mark (BOM) is used. The length of this field is determined |
| 1284 |
by subtracting the size of the previous fields from TSize. If both |
| 1285 |
the File Name and Comment fields are UTF-8, the new General Purpose |
| 1286 |
Bit Flag, bit 11 (Language encoding flag (EFS)), can be used to |
| 1287 |
indicate that both the header File Name and Comment fields are UTF-8 |
| 1288 |
and, in this case, the Unicode Path and Unicode Comment extra fields |
| 1289 |
are not needed and should not be created. Note that, for backward |
| 1290 |
compatibility, bit 11 should only be used if the native character set |
| 1291 |
of the paths and comments being zipped up are already in UTF-8. The |
| 1292 |
same method, either bit 11 or extra fields, should be used in both |
| 1293 |
the local and central directory headers. |
| 1294 |
|
| 1295 |
|
| 1296 |
-Info-ZIP Unicode Comment Extra Field: |
| 1297 |
==================================== |
| 1298 |
|
| 1299 |
Stores the UTF-8 version of the entry comment as stored in the |
| 1300 |
central directory header. |
| 1301 |
(Last Revision 20070912) |
| 1302 |
|
| 1303 |
Value Size Description |
| 1304 |
----- ---- ----------- |
| 1305 |
(UCom) 0x6375 Short tag for this extra block type ("uc") |
| 1306 |
TSize Short total data size for this block |
| 1307 |
Version 1 byte version of this extra field, currently 1 |
| 1308 |
ComCRC32 4 bytes Comment Field CRC32 Checksum |
| 1309 |
UnicodeCom Variable UTF-8 version of the entry comment |
| 1310 |
|
| 1311 |
Currently Version is set to the number 1. If there is a need |
| 1312 |
to change this field, the version will be incremented. Changes |
| 1313 |
may not be backward compatible so this extra field should not be |
| 1314 |
used if the version is not recognized. |
| 1315 |
|
| 1316 |
The ComCRC32 is the standard zip CRC32 checksum of the Comment |
| 1317 |
field in the central directory header. This is used to verify that |
| 1318 |
the comment field has not changed since the Unicode Comment extra field |
| 1319 |
was created. This can happen if a utility changes the Comment field |
| 1320 |
but does not update the UTF-8 Comment extra field. If the CRC check |
| 1321 |
fails, this Unicode Comment extra field should be ignored and the |
| 1322 |
Comment field in the header used. |
| 1323 |
|
| 1324 |
The UnicodeCom field is the UTF-8 version of the entry comment field |
| 1325 |
in the header. As UnicodeCom is defined to be UTF-8, no UTF-8 byte |
| 1326 |
order mark (BOM) is used. The length of this field is determined by |
| 1327 |
subtracting the size of the previous fields from TSize. If both the |
| 1328 |
File Name and Comment fields are UTF-8, the new General Purpose Bit |
| 1329 |
Flag, bit 11 (Language encoding flag (EFS)), can be used to indicate |
| 1330 |
both the header File Name and Comment fields are UTF-8 and, in this |
| 1331 |
case, the Unicode Path and Unicode Comment extra fields are not |
| 1332 |
needed and should not be created. Note that, for backward |
| 1333 |
compatibility, bit 11 should only be used if the native character set |
| 1334 |
of the paths and comments being zipped up are already in UTF-8. The |
| 1335 |
same method, either bit 11 or extra fields, should be used in both |
| 1336 |
the local and central directory headers. |
| 1337 |
|
| 1338 |
|
| 1339 |
-Info-ZIP New Unix Extra Field: |
| 1340 |
==================================== |
| 1341 |
|
| 1342 |
Currently stores Unix UIDs/GIDs up to 32 bits. |
| 1343 |
(Last Revision 20080509) |
| 1344 |
|
| 1345 |
Value Size Description |
| 1346 |
----- ---- ----------- |
| 1347 |
(UnixN) 0x7875 Short tag for this extra block type ("ux") |
| 1348 |
TSize Short total data size for this block |
| 1349 |
Version 1 byte version of this extra field, currently 1 |
| 1350 |
UIDSize 1 byte Size of UID field |
| 1351 |
UID Variable UID for this entry |
| 1352 |
GIDSize 1 byte Size of GID field |
| 1353 |
GID Variable GID for this entry |
| 1354 |
|
| 1355 |
Currently Version is set to the number 1. If there is a need |
| 1356 |
to change this field, the version will be incremented. Changes |
| 1357 |
may not be backward compatible so this extra field should not be |
| 1358 |
used if the version is not recognized. |
| 1359 |
|
| 1360 |
UIDSize is the size of the UID field in bytes. This size should |
| 1361 |
match the size of the UID field on the target OS. |
| 1362 |
|
| 1363 |
UID is the UID for this entry in standard little endian format. |
| 1364 |
|
| 1365 |
GIDSize is the size of the GID field in bytes. This size should |
| 1366 |
match the size of the GID field on the target OS. |
| 1367 |
|
| 1368 |
GID is the GID for this entry in standard little endian format. |
| 1369 |
|
| 1370 |
If both the old 16-bit Unix extra field (tag 0x7855, Info-ZIP Unix) |
| 1371 |
and this extra field are present, the values in this extra field |
| 1372 |
supercede the values in that extra field. |