llmora / zip_parser

Parse a ZIP file and print out information about its various sections
GNU General Public License v2.0
0 stars 0 forks source link

how to parse archive decryption header ? #1

Open changenamee opened 2 years ago

llmora commented 2 years ago

The encryption header is a random 12-byte value that is used as part of the decryption process, see for instance the header from a simple file as parsed by zip_parser:

[*] Encryption header: b'\x82+\xed\xab\x9e\x9e?\x86(h\xd6\xbd'

There is really no way to further parse it, you can read more about this header in section 6.1 "Traditional PKWARE Decryption" in the ZIP application note, extract below:

    6.1.3 Each encrypted file has an extra 12 bytes stored at the start 
    of the data area defining the encryption header for that file.  The
    encryption header is originally set to random values, and then
    itself encrypted, using three, 32-bit keys.  The key values are
    initialized using the supplied encryption password.  After each byte
    is encrypted, the keys are then updated using pseudo-random number
    generation techniques in combination with the same CRC-32 algorithm
    used in PKZIP and described elsewhere in this document.

I hope this helps, let me know if you have any other query.