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.,
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
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.
23
Christian Spieler, 20010517
25
-------------------------
27
Header ID's of 0 thru 31 are reserved for use by PKWARE.
28
The remaining ID's can be used by third party vendors for
31
The current Header ID mappings defined by PKWARE are:
33
0x0001 ZIP64 extended information extra field
35
0x0009 OS/2 extended attributes (also Info-ZIP)
36
0x000a NTFS (Win9x/WinNT FileTimes)
37
0x000c OpenVMS (also Info-ZIP)
39
0x000f Patch Descriptor
40
0x0014 PKCS#7 Store for X.509 Certificates
41
0x0015 X.509 Certificate ID and Signature for
43
0x0016 X.509 Certificate ID for Central Directory
45
The Header ID mappings defined by Info-ZIP and third parties are:
47
0x0065 IBM S/390 attributes - uncompressed
48
0x0066 IBM S/390 attributes - compressed
49
0x07c8 Info-ZIP Macintosh (old, J. Lee)
50
0x2605 ZipIt Macintosh (first version)
51
0x2705 ZipIt Macintosh v 1.3.5 and newer (w/o full filename)
52
0x334d Info-ZIP Macintosh (new, D. Haase's 'Mac3' field )
54
0x4341 Acorn/SparkFS (David Pilling)
55
0x4453 Windows NT security descriptor (binary ACL)
58
0x4854 Theos, old inofficial port
59
0x4b46 FWKCS MD5 (see below)
60
0x4c41 OS/2 access control list (text ACL)
61
0x4d49 Info-ZIP OpenVMS (obsolete)
62
0x4d63 Macintosh SmartZIP, by Macro Bambini
63
0x4f4c Xceed original location extra field
64
0x5356 AOS/VS (binary ACL)
65
0x5455 extended timestamp
66
0x5855 Info-ZIP Unix (original; also OS/2, NT, etc.)
67
0x554e Xceed unicode extra field
68
0x6542 BeOS (BeBox, PowerMac, etc.)
71
0x7855 Info-ZIP Unix (new)
74
The following are detailed descriptions of the known extra-field block types:
76
-OS/2 Extended Attributes Extra Field:
77
====================================
79
The following is the layout of the OS/2 extended attributes "extra"
80
block. (Last Revision 19960922)
82
Note: all fields stored in Intel low-byte/high-byte order.
86
Value Size Description
87
----- ---- -----------
88
(OS/2) 0x0009 Short tag for this extra block type
89
TSize Short total data size for this block
90
BSize Long uncompressed EA data size
91
CType Short compression type
92
EACRC Long CRC value for uncompressed EA data
93
(var.) variable compressed EA data
95
Central-header version:
97
Value Size Description
98
----- ---- -----------
99
(OS/2) 0x0009 Short tag for this extra block type
100
TSize Short total data size for this block (4)
101
BSize Long size of uncompressed local EA data
103
The value of CType is interpreted according to the "compression
104
method" section above; i.e., 0 for stored, 8 for deflated, etc.
106
The OS/2 extended attribute structure (FEA2LIST) is compressed and
107
then stored in its entirety within this structure. There will only
108
ever be one block of data in the variable-length field.
111
-OS/2 Access Control List Extra Field:
112
====================================
114
The following is the layout of the OS/2 ACL extra block.
115
(Last Revision 19960922)
117
Local-header version:
119
Value Size Description
120
----- ---- -----------
121
(ACL) 0x4c41 Short tag for this extra block type ("AL")
122
TSize Short total data size for this block
123
BSize Long uncompressed ACL data size
124
CType Short compression type
125
EACRC Long CRC value for uncompressed ACL data
126
(var.) variable compressed ACL data
128
Central-header version:
130
Value Size Description
131
----- ---- -----------
132
(ACL) 0x4c41 Short tag for this extra block type ("AL")
133
TSize Short total data size for this block (4)
134
BSize Long size of uncompressed local ACL data
136
The value of CType is interpreted according to the "compression
137
method" section above; i.e., 0 for stored, 8 for deflated, etc.
139
The uncompressed ACL data consist of a text header of the form
140
"ACL1:%hX,%hd\n", where the first field is the OS/2 ACCINFO acc_attr
141
member and the second is acc_count, followed by acc_count strings
142
of the form "%s,%hx\n", where the first field is acl_ugname (user
143
group name) and the second acl_access. This block type will be
144
extended for other operating systems as needed.
147
-Windows NT Security Descriptor Extra Field:
148
==========================================
150
The following is the layout of the NT Security Descriptor (another
151
type of ACL) extra block. (Last Revision 19960922)
153
Local-header version:
155
Value Size Description
156
----- ---- -----------
157
(SD) 0x4453 Short tag for this extra block type ("SD")
158
TSize Short total data size for this block
159
BSize Long uncompressed SD data size
160
Version Byte version of uncompressed SD data format
161
CType Short compression type
162
EACRC Long CRC value for uncompressed SD data
163
(var.) variable compressed SD data
165
Central-header version:
167
Value Size Description
168
----- ---- -----------
169
(SD) 0x4453 Short tag for this extra block type ("SD")
170
TSize Short total data size for this block (4)
171
BSize Long size of uncompressed local SD data
173
The value of CType is interpreted according to the "compression
174
method" section above; i.e., 0 for stored, 8 for deflated, etc.
175
Version specifies how the compressed data are to be interpreted
176
and allows for future expansion of this extra field type. Currently
177
only version 0 is defined.
179
For version 0, the compressed data are to be interpreted as a single
180
valid Windows NT SECURITY_DESCRIPTOR data structure, in self-relative
184
-PKWARE Win95/WinNT Extra Field:
185
==============================
187
The following description covers PKWARE's "NTFS" attributes
188
"extra" block, introduced with the release of PKZIP 2.50 for
189
Windows. (Last Revision 20001118)
191
(Note: At this time the Mtime, Atime and Ctime values may
192
be used on any WIN32 system.)
193
[Info-ZIP note: In the current implementations, this field has
194
a fixed total data size of 32 bytes and is only stored as local
197
Value Size Description
198
----- ---- -----------
199
(NTFS) 0x000a Short Tag for this "extra" block type
200
TSize Short Total Data Size for this block
201
Reserved Long for future use
202
Tag1 Short NTFS attribute tag value #1
203
Size1 Short Size of attribute #1, in bytes
204
(var.) SubSize1 Attribute #1 data
208
TagN Short NTFS attribute tag value #N
209
SizeN Short Size of attribute #N, in bytes
210
(var.) SubSize1 Attribute #N data
212
For NTFS, values for Tag1 through TagN are as follows:
213
(currently only one set of attributes is defined for NTFS)
216
----- ---- -----------
217
0x0001 2 bytes Tag for attribute #1
218
Size1 2 bytes Size of attribute #1, in bytes (24)
219
Mtime 8 bytes 64-bit NTFS file last modification time
220
Atime 8 bytes 64-bit NTFS file last access time
221
Ctime 8 bytes 64-bit NTFS file creation time
223
The total length for this block is 28 bytes, resulting in a
224
fixed size value of 32 for the TSize field of the NTFS block.
226
The NTFS filetimes are 64-bit unsigned integers, stored in Intel
227
(least significant byte first) byte order. They determine the
228
number of 1.0E-07 seconds (1/10th microseconds!) past WinNT "epoch",
229
which is "01-Jan-1601 00:00:00 UTC".
232
-PKWARE OpenVMS Extra Field:
233
==========================
235
The following is the layout of PKWARE's OpenVMS attributes "extra"
236
block. (Last Revision 12/17/91)
238
Note: all fields stored in Intel low-byte/high-byte order.
240
Value Size Description
241
----- ---- -----------
242
(VMS) 0x000c Short Tag for this "extra" block type
243
TSize Short Total Data Size for this block
244
CRC Long 32-bit CRC for remainder of the block
245
Tag1 Short OpenVMS attribute tag value #1
246
Size1 Short Size of attribute #1, in bytes
247
(var.) Size1 Attribute #1 data
251
TagN Short OpenVMS attribute tage value #N
252
SizeN Short Size of attribute #N, in bytes
253
(var.) SizeN Attribute #N data
257
1. There will be one or more of attributes present, which
258
will each be preceded by the above TagX & SizeX values.
259
These values are identical to the ATR$C_XXXX and
260
ATR$S_XXXX constants which are defined in ATR.H under
261
OpenVMS C. Neither of these values will ever be zero.
263
2. No word alignment or padding is performed.
265
3. A well-behaved PKZIP/OpenVMS program should never produce
266
more than one sub-block with the same TagX value. Also,
267
there will never be more than one "extra" block of type
268
0x000c in a particular directory record.
271
-Info-ZIP VMS Extra Field:
272
========================
274
The following is the layout of Info-ZIP's VMS attributes extra
275
block for VAX or Alpha AXP. The local-header and central-header
276
versions are identical. (Last Revision 19960922)
278
Value Size Description
279
----- ---- -----------
280
(VMS2) 0x4d49 Short tag for this extra block type ("JM")
281
TSize Short total data size for this block
283
Flags Short info bytes
284
BSize Short uncompressed block size
285
Reserved Long (reserved)
286
(var.) variable compressed VMS file-attributes block
288
The block ID is one of the following unterminated strings:
297
"VMSV" version (e.g., "V6.1"; truncated at hyphen)
300
The lower three bits of Flags indicate the compression method. The
301
currently defined methods are:
303
0 stored (not compressed)
307
The "RLE" method simply replaces zero-valued bytes with zero-valued
308
bits and non-zero-valued bytes with a "1" bit followed by the byte
311
The variable-length compressed data contains only the data corre-
312
sponding to the indicated structure or string. Typically multiple
313
VMS2 extra fields are present (each with a unique block type).
316
-Info-ZIP Macintosh Extra Field:
317
==============================
319
The following is the layout of the (old) Info-ZIP resource-fork extra
320
block for Macintosh. The local-header and central-header versions
321
are identical. (Last Revision 19960922)
323
Value Size Description
324
----- ---- -----------
325
(Mac) 0x07c8 Short tag for this extra block type
326
TSize Short total data size for this block
327
"JLEE" beLong extra-field signature
328
FInfo 16 bytes Macintosh FInfo structure
329
CrDat beLong HParamBlockRec fileParam.ioFlCrDat
330
MdDat beLong HParamBlockRec fileParam.ioFlMdDat
331
Flags beLong info bits
332
DirID beLong HParamBlockRec fileParam.ioDirID
333
VolName 28 bytes volume name (optional)
335
All fields but the first two are in native Macintosh format
336
(big-endian Motorola order, not little-endian Intel). The least
337
significant bit of Flags is 1 if the file is a data fork, 0 other-
338
wise. In addition, if this extra field is present, the filename
339
has an extra 'd' or 'r' appended to indicate data fork or resource
340
fork. The 28-byte VolName field may be omitted.
343
-ZipIt Macintosh Extra Field (long):
344
==================================
346
The following is the layout of the ZipIt extra block for Macintosh.
347
The local-header and central-header versions are identical.
348
(Last Revision 19970130)
350
Value Size Description
351
----- ---- -----------
352
(Mac2) 0x2605 Short tag for this extra block type
353
TSize Short total data size for this block
354
"ZPIT" beLong extra-field signature
355
FnLen Byte length of FileName
356
FileName variable full Macintosh filename
357
FileType Byte[4] four-byte Mac file type string
358
Creator Byte[4] four-byte Mac creator string
361
-ZipIt Macintosh Extra Field (short):
362
===================================
364
The following is the layout of a shortened variant of the
365
ZipIt extra block for Macintosh (without "full name" entry).
366
This variant is used by ZipIt 1.3.5 and newer for entries that
367
do not need a "full Mac filename" record.
368
The local-header and central-header versions are identical.
369
(Last Revision 19980903)
371
Value Size Description
372
----- ---- -----------
373
(Mac2b) 0x2705 Short tag for this extra block type
374
TSize Short total data size for this block (12)
375
"ZPIT" beLong extra-field signature
376
FileType Byte[4] four-byte Mac file type string
377
Creator Byte[4] four-byte Mac creator string
380
-Info-ZIP Macintosh Extra Field (new):
381
====================================
383
The following is the layout of the (new) Info-ZIP extra
384
block for Macintosh, designed by Dirk Haase.
385
All values are in little-endian.
386
(Last Revision 19981005)
388
Local-header version:
390
Value Size Description
391
----- ---- -----------
392
(Mac3) 0x334d Short tag for this extra block type ("M3")
393
TSize Short total data size for this block
394
BSize Long uncompressed finder attribute data size
395
Flags Short info bits
396
fdType Byte[4] Type of the File (4-byte string)
397
fdCreator Byte[4] Creator of the File (4-byte string)
398
(CType) Short compression type
399
(CRC) Long CRC value for uncompressed MacOS data
400
Attribs variable finder attribute data (see below)
403
Central-header version:
405
Value Size Description
406
----- ---- -----------
407
(Mac3) 0x334d Short tag for this extra block type ("M3")
408
TSize Short total data size for this block
409
BSize Long uncompressed finder attribute data size
410
Flags Short info bits
411
fdType Byte[4] Type of the File (4-byte string)
412
fdCreator Byte[4] Creator of the File (4-byte string)
414
The third bit of Flags in both headers indicates whether
415
the LOCAL extra field is uncompressed (and therefore whether CType
416
and CRC are omitted):
419
bit 0 if set, file is a data fork; otherwise unset
420
bit 1 if set, filename will be not changed
421
bit 2 if set, Attribs is uncompressed (no CType, CRC)
422
bit 3 if set, date and times are in 64 bit
423
if zero date and times are in 32 bit.
424
bit 4 if set, timezone offsets fields for the native
425
Mac times are omitted (UTC support deactivated)
431
Attribs is a Mac-specific block of data in little-endian format with
432
the following structure (if compressed, uncompress it first):
434
Value Size Description
435
----- ---- -----------
436
fdFlags Short Finder Flags
437
fdLocation.v Short Finder Icon Location
438
fdLocation.h Short Finder Icon Location
439
fdFldr Short Folder containing file
441
FXInfo 16 bytes Macintosh FXInfo structure
444
fdUnused[3] Short unused but reserved 6 bytes
445
fdScript Byte Script flag and number
446
fdXFlags Byte More flag bits
447
fdComment Short Comment ID
448
fdPutAway Long Home Dir ID
450
FVersNum Byte file version number
451
may be not used by MacOS
452
ACUser Byte directory access rights
454
FlCrDat ULong date and time of creation
455
FlMdDat ULong date and time of last modification
456
FlBkDat ULong date and time of last backup
457
These time numbers are original Mac FileTime values (local time!).
458
Currently, date-time width is 32-bit, but future version may
459
support be 64-bit times (see flags)
461
CrGMTOffs Long(signed!) difference "local Creat. time - UTC"
462
MdGMTOffs Long(signed!) difference "local Modif. time - UTC"
463
BkGMTOffs Long(signed!) difference "local Backup time - UTC"
464
These "local time - UTC" differences (stored in seconds) may be
465
used to support timestamp adjustment after inter-timezone transfer.
466
These fields are optional; bit 4 of the flags word controls their
469
Charset Short TextEncodingBase (Charset)
470
valid for the following two fields
472
FullPath variable Path of the current file.
473
Zero terminated string (C-String)
474
Currently coded in the native Charset.
476
Comment variable Finder Comment of the current file.
477
Zero terminated string (C-String)
478
Currently coded in the native Charset.
481
-SmartZIP Macintosh Extra Field:
482
====================================
484
The following is the layout of the SmartZIP extra
485
block for Macintosh, designed by Marco Bambini.
487
Local-header version:
489
Value Size Description
490
----- ---- -----------
491
0x4d63 Short tag for this extra block type ("cM")
492
TSize Short total data size for this block (64)
493
"dZip" beLong extra-field signature
494
fdType Byte[4] Type of the File (4-byte string)
495
fdCreator Byte[4] Creator of the File (4-byte string)
496
fdFlags beShort Finder Flags
497
fdLocation.v beShort Finder Icon Location
498
fdLocation.h beShort Finder Icon Location
499
fdFldr beShort Folder containing file
500
CrDat beLong HParamBlockRec fileParam.ioFlCrDat
501
MdDat beLong HParamBlockRec fileParam.ioFlMdDat
502
frScroll.v Byte vertical pos. of folder's scroll bar
503
fdScript Byte Script flag and number
504
frScroll.h Byte horizontal pos. of folder's scroll bar
505
fdXFlags Byte More flag bits
506
FileName Byte[32] full Macintosh filename (pascal string)
508
All fields but the first two are in native Macintosh format
509
(big-endian Motorola order, not little-endian Intel).
510
The extra field size is fixed to 64 bytes.
511
The local-header and central-header versions are identical.
514
-Acorn SparkFS Extra Field:
515
=========================
517
The following is the layout of David Pilling's SparkFS extra block
518
for Acorn RISC OS. The local-header and central-header versions are
519
identical. (Last Revision 19960922)
521
Value Size Description
522
----- ---- -----------
523
(Acorn) 0x4341 Short tag for this extra block type ("AC")
524
TSize Short total data size for this block (20)
525
"ARC0" Long extra-field signature
526
LoadAddr Long load address or file type
527
ExecAddr Long exec address
528
Attr Long file permissions
529
Zero Long reserved; always zero
531
The following bits of Attr are associated with the given file
534
bit 0 user-writable ('W')
535
bit 1 user-readable ('R')
538
bit 4 publicly writable ('w')
539
bit 5 publicly readable ('r')
547
The following is the layout of the file-attributes extra block for
548
VM/CMS. The local-header and central-header versions are
549
identical. (Last Revision 19960922)
551
Value Size Description
552
----- ---- -----------
553
(VM/CMS) 0x4704 Short tag for this extra block type
554
TSize Short total data size for this block
555
flData variable file attributes data
557
flData is an uncompressed fldata_t struct.
563
The following is the layout of the file-attributes extra block for
564
MVS. The local-header and central-header versions are identical.
565
(Last Revision 19960922)
567
Value Size Description
568
----- ---- -----------
569
(MVS) 0x470f Short tag for this extra block type
570
TSize Short total data size for this block
571
flData variable file attributes data
573
flData is an uncompressed fldata_t struct.
576
-PKWARE Unix Extra Field:
577
========================
579
The following is the layout of PKWARE's Unix "extra" block.
580
It was introduced with the release of PKZIP for Unix 2.50.
581
Note: all fields are stored in Intel low-byte/high-byte order.
582
(Last Revision 19980901)
584
This field has a minimum data size of 12 bytes and is only stored
585
as local extra field.
587
Value Size Description
588
----- ---- -----------
589
(Unix0) 0x000d Short Tag for this "extra" block type
590
TSize Short Total Data Size for this block
591
AcTime Long time of last access (UTC/GMT)
592
ModTime Long time of last modification (UTC/GMT)
593
UID Short Unix user ID
594
GID Short Unix group ID
595
(var) variable Variable length data field
597
The variable length data field will contain file type
598
specific data. Currently the only values allowed are
599
the original "linked to" file names for hard or symbolic
600
links, and the major and minor device node numbers for
601
character and block device nodes. Since device nodes
602
cannot be either symbolic or hard links, only one set of
603
variable length data is stored. Link files will have the
604
name of the original file stored. This name is NOT NULL
605
terminated. Its size can be determined by checking TSize -
606
12. Device entries will have eight bytes stored as two 4
607
byte entries (in little-endian format). The first entry
608
will be the major device number, and the second the minor
611
[Info-ZIP note: The fixed part of this field has the same layout as
612
Info-ZIP's abandoned "Unix1 timestamps & owner ID info" extra field;
613
only the two tag bytes are different.]
616
-PATCH Descriptor Extra Field:
617
============================
619
The following is the layout of the Patch Descriptor "extra"
622
Note: all fields stored in Intel low-byte/high-byte order.
624
Value Size Description
625
----- ---- -----------
626
(Patch) 0x000f Short Tag for this "extra" block type
627
TSize Short Size of the total "extra" block
628
Version Short Version of the descriptor
629
Flags Long Actions and reactions (see below)
630
OldSize Long Size of the file about to be patched
631
OldCRC Long 32-bit CRC of the file about to be patched
632
NewSize Long Size of the resulting file
633
NewCRC Long 32-bit CRC of the resulting file
636
Actions and reactions
639
---- ----------------
640
0 Use for autodetection
643
4-5 Action (see below)
645
8-9 Reaction (see below) to absent file
646
10-11 Reaction (see below) to newer file
647
12-13 Reaction (see below) to unknown file
670
-PKCS#7 Store for X.509 Certificates:
671
===================================
673
This field is contains the information about each
674
certificate a file is signed with. This field should only
675
appear in the first central directory record, and will be
676
ignored in any other record.
678
Note: all fields stored in Intel low-byte/high-byte order.
680
Value Size Description
681
----- ---- -----------
682
(Store) 0x0014 2 bytes Tag for this "extra" block type
683
SSize 2 bytes Size of the store data
684
SData (variable) Data about the store
687
Value Size Description
688
----- ---- -----------
689
Version 2 bytes Version number, 0x0001 for now
690
StoreD (variable) Actual store data
692
The StoreD member is suitable for passing as the pbData
693
member of a CRYPT_DATA_BLOB to the CertOpenStore() function
694
in Microsoft's CryptoAPI. The SSize member above will be
695
cbData + 6, where cbData is the cbData member of the same
696
CRYPT_DATA_BLOB. The encoding type to pass to
697
CertOpenStore() should be
698
PKCS_7_ANS_ENCODING | X509_ASN_ENCODING.
701
-X.509 Certificate ID and Signature for individual file:
702
======================================================
704
This field contains the information about which certificate
705
in the PKCS#7 Store was used to sign the particular file.
706
It also contains the signature data. This field can appear
707
multiple times, but can only appear once per certificate.
709
Note: all fields stored in Intel low-byte/high-byte order.
711
Value Size Description
712
----- ---- -----------
713
(CID) 0x0015 2 bytes Tag for this "extra" block type
714
CSize 2 bytes Size of Method
718
Value Size Description
719
----- ---- -----------
720
Version 2 bytes Version number, for now 0x0001
721
AlgID 2 bytes Algorithm ID used for signing
722
IDSize 2 bytes Size of Certificate ID data
723
CertID (variable) Certificate ID data
724
SigSize 2 bytes Size of Signature data
725
Sig (variable) Signature data
728
Value Size Description
729
----- ---- -----------
730
Size1 4 bytes Size of CertID, should be (IDSize - 4)
731
Size1 4 bytes A bug in version one causes this value
733
IssSize 4 bytes Issuer data size
734
Issuer (variable) Issuer data
735
SerSize 4 bytes Serial Number size
736
Serial (variable) Serial Number data
738
The Issuer and IssSize members are suitable for creating a
739
CRYPT_DATA_BLOB to be the Issuer member of a CERT_INFO
740
struct. The Serial and SerSize members would be the
741
SerialNumber member of the same CERT_INFO struct. This
742
struct would be used to find the certificate in the store
743
the file was signed with. Those structures are from the MS
746
Sig and SigSize are the actual signature data and size
747
generated by signing the file with the MS CryptoAPI using a
748
hash created with the given AlgID.
751
-X.509 Certificate ID and Signature for central directory:
752
========================================================
754
This field contains the information about which certificate
755
in the PKCS#7 Store was used to sign the central directory.
756
It should only appear with the first central directory
757
record, along with the store. The data structure is the
758
same as the CID, except that SigSize will be 0, and there
759
will be no Sig member.
761
This field is also kept after the last central directory
762
record, as the signature data (ID 0x05054b50, it looks like
763
a central directory record of a different type). This
764
second copy of the data is the Signature Data member of the
765
record, and will have a SigSize that is non-zero, and will
768
Note: all fields stored in Intel low-byte/high-byte order.
770
Value Size Description
771
----- ---- -----------
772
(CDID) 0x0016 2 bytes Tag for this "extra" block type
773
CSize 2 bytes Size of Method
777
-ZIP64 Extended Information Extra Field:
778
======================================
780
The following is the layout of the ZIP64 extended
781
information "extra" block. If one of the size or
782
offset fields in the Local or Central directory
783
record is too small to hold the required data,
784
a ZIP64 extended information record is created.
785
The order of the fields in the ZIP64 extended
786
information record is fixed, but the fields will
787
only appear if the corresponding Local or Central
788
directory record field is set to 0xFFFF or 0xFFFFFFFF.
790
Note: all fields stored in Intel low-byte/high-byte order.
792
Value Size Description
793
----- ---- -----------
794
(ZIP64) 0x0001 2 bytes Tag for this "extra" block type
795
Size 2 bytes Size of this "extra" block
797
Size 8 bytes Original uncompresseed file size
799
Size 8 bytes Size of compressed data
801
Offset 8 bytes Offset of local header record
803
Number 4 bytes Number of the disk on which
806
This entry in the Local header must include BOTH original
807
and compressed file sizes.
810
-Extended Timestamp Extra Field:
811
==============================
813
The following is the layout of the extended-timestamp extra block.
814
(Last Revision 19970118)
816
Local-header version:
818
Value Size Description
819
----- ---- -----------
820
(time) 0x5455 Short tag for this extra block type ("UT")
821
TSize Short total data size for this block
823
(ModTime) Long time of last modification (UTC/GMT)
824
(AcTime) Long time of last access (UTC/GMT)
825
(CrTime) Long time of original creation (UTC/GMT)
827
Central-header version:
829
Value Size Description
830
----- ---- -----------
831
(time) 0x5455 Short tag for this extra block type ("UT")
832
TSize Short total data size for this block
833
Flags Byte info bits (refers to local header!)
834
(ModTime) Long time of last modification (UTC/GMT)
836
The central-header extra field contains the modification time only,
837
or no timestamp at all. TSize is used to flag its presence or
840
If "Flags" indicates that Modtime is present in the local header
841
field, it MUST be present in the central header field, too!
842
This correspondence is required because the modification time
843
value may be used to support trans-timezone freshening and
844
updating operations with zip archives.
846
The time values are in standard Unix signed-long format, indicating
847
the number of seconds since 1 January 1970 00:00:00. The times
848
are relative to Coordinated Universal Time (UTC), also sometimes
849
referred to as Greenwich Mean Time (GMT). To convert to local time,
850
the software must know the local timezone offset from UTC/GMT.
852
The lower three bits of Flags in both headers indicate which time-
853
stamps are present in the LOCAL extra field:
855
bit 0 if set, modification time is present
856
bit 1 if set, access time is present
857
bit 2 if set, creation time is present
858
bits 3-7 reserved for additional timestamps; not set
860
Those times that are present will appear in the order indicated, but
861
any combination of times may be omitted. (Creation time may be
862
present without access time, for example.) TSize should equal
863
(1 + 4*(number of set bits in Flags)), as the block is currently
864
defined. Other timestamps may be added in the future.
867
-Info-ZIP Unix Extra Field (type 1):
868
==================================
870
The following is the layout of the old Info-ZIP extra block for
871
Unix. It has been replaced by the extended-timestamp extra block
872
(0x5455) and the Unix type 2 extra block (0x7855).
873
(Last Revision 19970118)
875
Local-header version:
877
Value Size Description
878
----- ---- -----------
879
(Unix1) 0x5855 Short tag for this extra block type ("UX")
880
TSize Short total data size for this block
881
AcTime Long time of last access (UTC/GMT)
882
ModTime Long time of last modification (UTC/GMT)
883
UID Short Unix user ID (optional)
884
GID Short Unix group ID (optional)
886
Central-header version:
888
Value Size Description
889
----- ---- -----------
890
(Unix1) 0x5855 Short tag for this extra block type ("UX")
891
TSize Short total data size for this block
892
AcTime Long time of last access (GMT/UTC)
893
ModTime Long time of last modification (GMT/UTC)
895
The file access and modification times are in standard Unix signed-
896
long format, indicating the number of seconds since 1 January 1970
897
00:00:00. The times are relative to Coordinated Universal Time
898
(UTC), also sometimes referred to as Greenwich Mean Time (GMT). To
899
convert to local time, the software must know the local timezone
900
offset from UTC/GMT. The modification time may be used by non-Unix
901
systems to support inter-timezone freshening and updating of zip
904
The local-header extra block may optionally contain UID and GID
905
info for the file. The local-header TSize value is the only
906
indication of this. Note that Unix UIDs and GIDs are usually
907
specific to a particular machine, and they generally require root
910
This extra field type is obsolete, but it has been in use since
911
mid-1994. Therefore future archiving software should continue to
912
support it. Some guidelines:
914
An archive member should either contain the old "Unix1"
915
extra field block or the new extra field types "time" and/or
918
If both the old "Unix1" block type and one or both of the new
919
block types "time" and "Unix2" are found, the "Unix1" block
920
should be considered invalid and ignored.
922
Unarchiving software should recognize both old and new extra
923
field block types, but the info from new types overrides the
926
Archiving software should recognize "Unix1" extra fields for
927
timestamp comparison but never create it for updated, freshened
928
or new archive members. When copying existing members to a new
929
archive, any "Unix1" extra field blocks should be converted to
930
the new "time" and/or "Unix2" types.
933
-Info-ZIP Unix Extra Field (type 2):
934
==================================
936
The following is the layout of the new Info-ZIP extra block for
937
Unix. (Last Revision 19960922)
939
Local-header version:
941
Value Size Description
942
----- ---- -----------
943
(Unix2) 0x7855 Short tag for this extra block type ("Ux")
944
TSize Short total data size for this block (4)
945
UID Short Unix user ID
946
GID Short Unix group ID
948
Central-header version:
950
Value Size Description
951
----- ---- -----------
952
(Unix2) 0x7855 Short tag for this extra block type ("Ux")
953
TSize Short total data size for this block (0)
955
The data size of the central-header version is zero; it is used
956
solely as a flag that UID/GID info is present in the local-header
957
extra field. If additional fields are ever added to the local
958
version, the central version may be extended to indicate this.
960
Note that Unix UIDs and GIDs are usually specific to a particular
961
machine, and they generally require root access to restore.
964
-ASi Unix Extra Field:
967
The following is the layout of the ASi extra block for Unix. The
968
local-header and central-header versions are identical.
969
(Last Revision 19960916)
971
Value Size Description
972
----- ---- -----------
973
(Unix3) 0x756e Short tag for this extra block type ("nu")
974
TSize Short total data size for this block
975
CRC Long CRC-32 of the remaining data
976
Mode Short file permissions
977
SizDev Long symlink'd size OR major/minor dev num
980
(var.) variable symbolic link filename
982
Mode is the standard Unix st_mode field from struct stat, containing
983
user/group/other permissions, setuid/setgid and symlink info, etc.
985
If Mode indicates that this file is a symbolic link, SizDev is the
986
size of the file to which the link points. Otherwise, if the file
987
is a device, SizDev contains the standard Unix st_rdev field from
988
struct stat (includes the major and minor numbers of the device).
989
SizDev is undefined in other cases.
991
If Mode indicates that the file is a symbolic link, the final field
992
will be the name of the file to which the link points. The file-
993
name length can be inferred from TSize.
995
[Note that TSize may incorrectly refer to the data size not counting
996
the CRC; i.e., it may be four bytes too small.]
1002
The following is the layout of the file-attributes extra block for
1003
BeOS. (Last Revision 19970531)
1005
Local-header version:
1007
Value Size Description
1008
----- ---- -----------
1009
(BeOS) 0x6542 Short tag for this extra block type ("Be")
1010
TSize Short total data size for this block
1011
BSize Long uncompressed file attribute data size
1012
Flags Byte info bits
1013
(CType) Short compression type
1014
(CRC) Long CRC value for uncompressed file attribs
1015
Attribs variable file attribute data
1017
Central-header version:
1019
Value Size Description
1020
----- ---- -----------
1021
(BeOS) 0x6542 Short tag for this extra block type ("Be")
1022
TSize Short total data size for this block (5)
1023
BSize Long size of uncompr. local EF block data
1024
Flags Byte info bits
1026
The least significant bit of Flags in both headers indicates whether
1027
the LOCAL extra field is uncompressed (and therefore whether CType
1028
and CRC are omitted):
1030
bit 0 if set, Attribs is uncompressed (no CType, CRC)
1031
bits 1-7 reserved; if set, assume error or unknown data
1033
Currently the only supported compression types are deflated (type 8)
1034
and stored (type 0); the latter is not used by Info-ZIP's Zip but is
1037
Attribs is a BeOS-specific block of data in big-endian format with
1038
the following structure (if compressed, uncompress it first):
1040
Value Size Description
1041
----- ---- -----------
1042
Name variable attribute name (null-terminated string)
1043
Type Long attribute type (32-bit unsigned integer)
1044
Size Long Long data size for this sub-block (64 bits)
1045
Data variable attribute data
1047
The attribute structure is repeated for every attribute. The Data
1048
field may contain anything--text, flags, bitmaps, etc.
1051
-SMS/QDOS Extra Field:
1052
====================
1054
The following is the layout of the file-attributes extra block for
1055
SMS/QDOS. The local-header and central-header versions are identical.
1056
(Last Revision 19960929)
1058
Value Size Description
1059
----- ---- -----------
1060
(QDOS) 0xfb4a Short tag for this extra block type
1061
TSize Short total data size for this block
1062
LongID Long extra-field signature
1063
(ExtraID) Long additional signature/flag bytes
1064
QDirect 64 bytes qdirect structure
1066
LongID may be "QZHD" or "QDOS". In the latter case, ExtraID will
1067
be present. Its first three bytes are "02\0"; the last byte is
1068
currently undefined.
1070
QDirect contains the file's uncompressed directory info (qdirect
1071
struct). Its elements are in native (big-endian) format:
1073
d_length beLong file length
1074
d_access byte file access type
1075
d_type byte file type
1076
d_datalen beLong data length
1077
d_reserved beLong unused
1078
d_szname beShort size of filename
1079
d_name 36 bytes filename
1080
d_update beLong time of last update
1081
d_refdate beLong file version number
1082
d_backup beLong time of last backup (archive date)
1085
-AOS/VS Extra Field:
1088
The following is the layout of the extra block for Data General
1089
AOS/VS. The local-header and central-header versions are identical.
1090
(Last Revision 19961125)
1092
Value Size Description
1093
----- ---- -----------
1094
(AOSVS) 0x5356 Short tag for this extra block type ("VS")
1095
TSize Short total data size for this block
1096
"FCI\0" Long extra-field signature
1097
Version Byte version of AOS/VS extra block (10 = 1.0)
1098
Fstat variable fstat packet
1099
AclBuf variable raw ACL data ($MXACL bytes)
1101
Fstat contains the file's uncompressed fstat packet, which is one of
1104
normal fstat packet (P_FSTAT struct)
1105
DIR/CPD fstat packet (P_FSTAT_DIR struct)
1106
unit (device) fstat packet (P_FSTAT_UNIT struct)
1107
IPC file fstat packet (P_FSTAT_IPC struct)
1109
AclBuf contains the raw ACL data; its length is $MXACL.
1112
-Tandem NSK Extra Field:
1113
======================
1115
The following is the layout of the file-attributes extra block for
1116
Tandem NSK. The local-header and central-header versions are
1117
identical. (Last Revision 19981221)
1119
Value Size Description
1120
----- ---- -----------
1121
(TA) 0x4154 Short tag for this extra block type ("TA")
1122
TSize Short total data size for this block (20)
1123
NSKattrs 20 Bytes NSK attributes
1129
The following is the layout of the file-attributes extra block for
1130
Theos. The local-header and central-header versions are identical.
1131
(Last Revision 19990206)
1133
Value Size Description
1134
----- ---- -----------
1135
(Theos) 0x6854 Short 'Th' signature
1136
size Short size of extra block
1137
flags Byte reserved for future use
1138
filesize Long file size
1139
fileorg Byte type of file (see below)
1140
keylen Short key length for indexed and keyed files,
1141
data segment size for 16 bits programs
1142
reclen Short record length for indexed,keyed and direct,
1143
text segment size for 16 bits programs
1144
filegrow Byte growing factor for indexed,keyed and direct
1145
protect Byte protections (see below)
1146
reserved Short reserved for future use
1151
0x80 library (keyed access list of files)
1158
0x01 16 bits real mode program (obsolete)
1159
0x21 16 bits protected mode program
1160
0x41 32 bits protected mode program
1176
0x40 non executable Theos before 4.0
1177
0x40 modified Theos 4.x
1181
-THEOS old inofficial Extra Field:
1182
================================
1184
The following is the layout of an inoffical former version of a
1185
Theos file-attributes extra blocks. This layout was never published
1186
and is no longer created. However, UnZip can optionally support it
1187
when compiling with the option flag OLD_THEOS_EXTRA defined.
1188
Both the local-header and central-header versions are identical.
1189
(Last Revision 19990206)
1191
Value Size Description
1192
----- ---- -----------
1193
(THS0) 0x4854 Short 'TH' signature
1194
size Short size of extra block
1195
flags Short reserved for future use
1196
filesize Long file size
1197
reclen Short record length for indexed,keyed and direct,
1198
text segment size for 16 bits programs
1199
keylen Short key length for indexed and keyed files,
1200
data segment size for 16 bits programs
1201
filegrow Byte growing factor for indexed,keyed and direct
1202
reserved 3 Bytes reserved for future use
1205
-FWKCS MD5 Extra Field:
1206
=====================
1208
The FWKCS Contents_Signature System, used in automatically
1209
identifying files independent of filename, optionally adds
1210
and uses an extra field to support the rapid creation of
1211
an enhanced contents_signature.
1212
There is no local-header version; the following applies
1213
only to the central header. (Last Revision 19961207)
1215
Central-header version:
1217
Value Size Description
1218
----- ---- -----------
1219
(MD5) 0x4b46 Short tag for this extra block type ("FK")
1220
TSize Short total data size for this block (19)
1221
"MD5" 3 bytes extra-field signature
1222
MD5hash 16 bytes 128-bit MD5 hash of uncompressed data
1225
When FWKCS revises a .ZIP file central directory to add
1226
this extra field for a file, it also replaces the
1227
central directory entry for that file's uncompressed
1228
file length with a measured value.
1230
FWKCS provides an option to strip this extra field, if
1231
present, from a .ZIP file central directory. In adding
1232
this extra field, FWKCS preserves .ZIP file Authenticity
1233
Verification; if stripping this extra field, FWKCS
1234
preserves all versions of AV through PKZIP version 2.04g.
1236
FWKCS, and FWKCS Contents_Signature System, are
1237
trademarks of Frederick W. Kantor.
1239
(1) R. Rivest, RFC1321.TXT, MIT Laboratory for Computer
1240
Science and RSA Data Security, Inc., April 1992.
1241
ll.76-77: "The MD5 algorithm is being placed in the
1242
public domain for review and possible adoption as a