Open HimeWorks opened 8 years ago
You are correct, the content is compressed then encrypted. With a traditional PKWARE encryption, the header (needed to decrypt the file) is in the data section. With WinZip's AES encryption, the header is as an extra data of the entry. The metadata (local file headers, central directory) are only encrypted by PKWARE Strong Encryption but it's covered by a patent: we can ignore it.
JSZip uses internally a stream (async
accumulates the result) but the idea is the same. This would need #248 (to get the header).
In that case, we could "register" an object with a supports(zip entry)
method and a transform(data)
method. The same could be done with the compression.
See also #115.
I add some Aes decryption code, please see at #696. But I'm not sure if the code flow is right😂
There are JS libraries available for various encryption algorithms.
My understanding of how JSZip works is when I ask for a file to be loaded from the archive, it will automatically be decompressed for me.
I believe zip files are encrypted after they are compressed, so I will need to perform decryption before the decompression occurs.
Would it be possible to
So for example, I might set a
beforeDecompress
listener so that wheneverasync
is called, it will grab the entry, run it through the callback, and then proceed to decompress it as usual.My assumption is that the file directory can be read the same way as a zip archive without any encrypted entries.