E
E
Evgeny Ivanovich2021-01-24 21:49:31
linux
Evgeny Ivanovich, 2021-01-24 21:49:31

How to encrypt zip archive headers?

In general, there is a password-protected zip archive, but with open headers, which allows you to read the contents of the archive without access to the contents of the files. The question is how to encrypt the archive headers without recreating it?

7z a test.7z ./DOWNLOADS/ -p"123"Creating an archive with a password but with open headers.

7z a test.7z ./DOWNLOADS/ -p"123" -mhe=onThe same as above, only the headers are encrypted in the same way.

with pyzipper.AESZipFile(output_file, 'w',
                        compression=pyzipper.ZIP_LZMA,
                        encryption=pyzipper.WZ_AES) as zipObj:

        zipObj.setpassword(bytes('123', 'ascii'))

        for i, path in enumerate(paths):
            basename = os.path.basename(path)
            zipObj.write(path, basename) #ZIP_DEFLATED
Equivalent to the first command. Interested in a solution either based on the library, or based on the shell command but without re-creating the archive. Of course, you can implement the creation of a shell archive with a command, and it's easier, but I already wrote the code, and I'm too lazy to delete it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Happy Atman, 2021-01-25
@Happyatman

A very interesting philosophical question.
I understand that unencrypted headers are in the archive file?
And you want to change the contents (headers) of this file (archive) without changing the file (archive) itself?
This, of course, is not quite the answer to your question, but I'm too lazy to delete it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question