Menu ▾ ▴

#69 Encryption enabled streaming

v1.0 (example)
open
nobody
None
5
2022-11-16
2022-08-02
No

Not sure if this is a bug or a feature, but when I create an encrypted zip file, the resulting file has been written in streaming mode .

First create an encrypted zip file

$ zip -e -P password /tmp/pwd.zip lorem.txt

Now dump the metadata & note the present of the streaming artefacts

$ zipdetails /tmp/pwd.zip 

0000 LOCAL HEADER #1       04034B50
0004 Extract Zip Spec      14 '2.0'
0005 Extract OS            00 'MS-DOS'
0006 General Purpose Flag  0009
     [Bit  0]              1 'Encryption'
     [Bits 1-2]            0 'Normal Compression'
     [Bit  3]              1 'Streamed'
0008 Compression Method    0008 'Deflated'
000A Last Mod Time         52988571 'Sat Apr 24 17:43:34 2021'
000E CRC                   F90EE7FF
0012 Compressed Length     0000011A
0016 Uncompressed Length   000001BE
001A Filename Length       0009
001C Extra Length          001C
001E Filename              'lorem.txt'
0027 Extra ID #0001        5455 'UT: Extended Timestamp'
0029   Length              0009
002B   Flags               '03 mod access'
002C   Mod Time            60843CA6 'Sat Apr 24 16:43:34 2021'
0030   Access Time         62E7CDA3 'Mon Aug  1 13:57:07 2022'
0034 Extra ID #0002        7875 'ux: Unix Extra Type 3'
0036   Length              000B
0038   Version             01
0039   UID Size            04
003A   UID                 000003E8
003E   GID Size            04
003F   GID                 000003E8
0043 PAYLOAD

015D STREAMING DATA HEADER 08074B50
0161 CRC                   F90EE7FF
0165 Compressed Length     0000011A
0169 Uncompressed Length   000001BE

016D CENTRAL HEADER #1     02014B50
0171 Created Zip Spec      1E '3.0'
0172 Created OS            03 'Unix'
0173 Extract Zip Spec      14 '2.0'
0174 Extract OS            00 'MS-DOS'
0175 General Purpose Flag  0009
     [Bit  0]              1 'Encryption'
     [Bits 1-2]            0 'Normal Compression'
     [Bit  3]              1 'Streamed'
0177 Compression Method    0008 'Deflated'
0179 Last Mod Time         52988571 'Sat Apr 24 17:43:34 2021'
017D CRC                   F90EE7FF
0181 Compressed Length     0000011A
0185 Uncompressed Length   000001BE
0189 Filename Length       0009
018B Extra Length          0018
018D Comment Length        0000
018F Disk Start            0000
0191 Int File Attributes   0001
     [Bit 0]               1 Text Data
0193 Ext File Attributes   81ED0000
0197 Local Header Offset   00000000
019B Filename              'lorem.txt'
01A4 Extra ID #0001        5455 'UT: Extended Timestamp'
01A6   Length              0005
01A8   Flags               '03 mod access'
01A9   Mod Time            60843CA6 'Sat Apr 24 16:43:34 2021'
01AD Extra ID #0002        7875 'ux: Unix Extra Type 3'
01AF   Length              000B
01B1   Version             01
01B2   UID Size            04
01B3   UID                 000003E8
01B7   GID Size            04
01B8   GID                 000003E8

01BC END CENTRAL HEADER    06054B50
01C0 Number of this disk   0000
01C2 Central Dir Disk no   0000
01C4 Entries in this disk  0001
01C6 Total Entries         0001
01C8 Size of Central Dir   0000004F
01CC Offset to Central Dir 0000016D
01D0 Comment Length        0000
Done

Given that we are writing to a seekable file, I'm not clear why streaming has been triggered.

See this with zip 3.0 and the 3.1d beta.

1 Attachments

Discussion

  • Ed Gordon

    Ed Gordon - 2022-08-02

    I'll have to look, but basic zip encryption is a funny thing. The original authors made some assumptions on how to do it, which were accepted by others. I'll try to look at this in the next week and refresh myself on what's going on. I believe the answer is driven by what information is available when during the encryption process.
    Given how weak basic zip encryption is, it probably shouldn't be used much now, except in cases where cracking is not much of a concern. Zip 3.1e, whenever that is finalized, now bundles AES encryption in the base package.

     

Log in to post a comment.