Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

password protected Zip file #93

Closed
mmguero opened this issue Dec 21, 2023 · 22 comments
Closed

password protected Zip file #93

mmguero opened this issue Dec 21, 2023 · 22 comments

Comments

@mmguero
Copy link

mmguero commented Dec 21, 2023

Would it be possible for this library to support creation of a password-protected Zip file? I know there are some libraries like pyminizip that can do it but the streaming nature of stream-zip is much better in other respects.

@michalc
Copy link
Member

michalc commented Dec 22, 2023

@mmguero Probably yes - it's especially a bit odd that the sibling package to this, https://github.com/uktrade/stream-unzip, can decrypt/open password protected ZIP files, but this package can't make them.

Do you have a particular type of password protection that would be useful for your use case? There are a few: e.g. Legacy/ZipCrypto/Zip 2.0, or Winzip-style AES? (Or even, I think there's a more modern PKZip "official" password protected format that I don't know too much about, but I suspect creating such ZIPs might be a no-go without PKZip's permission)

(Also: no particular ETA on this as well if you would like this for a current project)

@mmguero
Copy link
Author

mmguero commented Dec 22, 2023

Yeah it's something of a tradeoff, isn't it? From what I understand the zipcrypto encryption is pretty easily cracked with brute force. Both WinZIP and 7zip (and a few others) support AES-256 which is much better security-wise but can't be opened by Windows natively. So it's a tradeoff of compatibility vs. security.

Part of me almost says to go with the less secure, more compatible option because if I'm going to go with something they'd need to download 7zip for anyway I might as well just look at py7zr and create a .7z archive. But as a cybersecurity guy I also strongly see the argument for the real encryption.

It looks like your stream-unzip package can handle both, so maybe making both an option? If not, I'd be happy with whatever you think would be best for the project's sake, I could live with either.

@michalc
Copy link
Member

michalc commented Dec 23, 2023

But as a cybersecurity guy I also strongly see the argument for the real encryption. ...
... I'd be happy with whatever you think would be best for the project's sake

I think I'm tempted for just Winzip's AES really. Keeps the API surface small, less scope for accidentally using the less secure one, less to code up, and since ZipCrypto is apparently so easy to crack, it would essentially just be adding code and faff without much of a benefit in terms of security - and maybe even a negative benefit if it's chosen rather than making sure both sides support AES.

(I'm wondering now if stream-unzip should even remove support for ZipCrypto for a similar reason... hmmm....)

@mmguero
Copy link
Author

mmguero commented Dec 23, 2023

I think that makes a lot of sense. AES is probably the way to go.

@guysl10
Copy link

guysl10 commented Dec 24, 2023

Hey,
I just now got into this issue. I am looking for a stream zipper that can zip with a password.
In my case, I don't need the best password encryption.
My need is to pass a suspicious file. If I deliver the file to download as it is and not zipped with a password, the antivirus will prevent me from downloading it.

So, for example, I don't need the best encryption but the ability to zip with a password as stream.

@michalc
Copy link
Member

michalc commented Dec 25, 2023

@guysl10 That’s an interesting use case that I never considered… Essentially it’s to “work around antivirus”?

What’s the antivirus? Is there no way to mark the specific file as allowed because you really want it? Also: what would then uncompress the compressed suspicious file?

@guysl10
Copy link

guysl10 commented Dec 25, 2023

@michalc Yep, I want to help analysts download suspicious files from my website for investigations.
The problem is if I let them download the file as it is, any antivirus will prevent them from downloading it. The problem is not with a specific antivirus but any antivirus / EDR agent. When the file is zipped with a password, the antivirus will not detect the file and will allow the user to download the file.
Another important note is that if I zip the file without a password, the antivirus can extract and prevent the user from downloading it.
I want to give the user a solution rather than asking them for exceptions whenever they want to download a suspicious file.
This is a widespread way to work with suspicious / malware files when you need to investigate them.
The user (analyst) will uncompress the file, but they can move the file to a quarantined environment.

I hope this explains my needs better :)

@michalc
Copy link
Member

michalc commented Dec 25, 2023

Ah understood. Although one thing:

The user (analyst) will uncompress the file, but they can move the file to a quarantined environment.

What would they use to uncompress it? And more specifically, would it support Winzip's AES ZIP format?

@guysl10
Copy link

guysl10 commented Dec 25, 2023

@michalc The common use is to uncompress it to investigate the suspicious file (reverse engineering \ running in a sandbox). They should use standard zippers, Winrar / Winzip / 7zip, etc.

@michalc
Copy link
Member

michalc commented Dec 25, 2023

@guysl10 Ah so it sounds like while AES is maybe overkill for your particular use case, it's still acceptable(?)

@guysl10
Copy link

guysl10 commented Dec 31, 2023

@michalc Yes, you are right. AES could also work for me. But what is more important for me is the zip with the password than the level of encryption the zip will have. :)

@michalc
Copy link
Member

michalc commented Jan 3, 2024

Just to communicate made a very small start on this in #94

@michalc
Copy link
Member

michalc commented Jan 4, 2024

#94 is getting there I think. Need to tidy it up a bit

michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
This adds AES-2 encryption as requested/discussed in
#93 and defined at
https://www.winzip.com/en/support/aes-encryption/

For now, AES-2 is used over AES-1 to prevent leakage of information via CRC-32
for small files, at the price of not having a checksum on the uncompressed
plain text data (although there is an HMAC check on the encrypted compressed
data as part of AES-2). In a later change, we should be able to make it AES-1
for larger files as recommended at
https://www.winzip.com/en/support/aes-encryption/, but not doing this now to
keep this change reasonably small.
michalc added a commit that referenced this issue Jan 4, 2024
…tion

This changes documentation in what is now the "Password protection /
encryption" section. It also changes tests to make sure the example in the
documentation works, and to try to make sure that the examples in the tests are
not seen as good practice.

Specifically it links to https://crypto.stackexchange.com/a/109269/113464 which
serves as a bit of a warning, but also contains some advice. And, it makes the
password in the example longer and random.

It does not implement all the recommendations at
https://crypto.stackexchange.com/a/109269/113464 at least for now to keep this
change small while I consider them - they may come in later changes (e.g.
renaming password to passphrase or generating a default ourselves).

This is done as part of the request/discussion at
#93
michalc added a commit that referenced this issue Jan 4, 2024
…tion

This changes documentation in what is now the "Password protection /
encryption" section. It also changes tests to make sure the example in the
documentation works, and makes the tests themselves use better practices, in
case they are seen down the line as examples to follow in the real world.

Specifically, it links to https://crypto.stackexchange.com/a/109269/113464
which serves as a bit of a warning, but also contains some advice. And, it
makes the password in the example longer and random.

It does not implement all the recommendations at
https://crypto.stackexchange.com/a/109269/113464 at least for now to keep this
change small while I consider them - they may come in later changes (e.g.
renaming password to passphrase or generating a default ourselves).

This is done as part of the request/discussion at
#93
michalc added a commit that referenced this issue Jan 4, 2024
…tion

This changes documentation in what is now the "Password protection /
encryption" section. It also changes tests to make sure the example in the
documentation works, and makes the tests themselves use better practices, in
case they are seen down the line as examples to follow in the real world.

Specifically, it links to https://crypto.stackexchange.com/a/109269/113464
which serves as a bit of a warning, but also contains some advice. And, it
makes the password in the example longer and random.

It does not implement all the recommendations at
https://crypto.stackexchange.com/a/109269/113464 at least for now to keep this
change small while I consider them - they may come in later changes (e.g.
renaming password to passphrase or generating a default ourselves).

This is done as part of the request/discussion at
#93
michalc added a commit that referenced this issue Jan 4, 2024
Because the encryption has some gotchas and shouldn't be used if not informed,
think it's more appropriate to be in the advanced section.

This is done in response to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
michalc added a commit that referenced this issue Jan 5, 2024
This gives more specific limitations about AE-2, rather than just depending on
external links.

This is to allow people to make more informed decisions on whether to use it or
not. I am maybe torn on whether to refer to AE-2's "flaws" or "limitations",
but opting to use the word "flaws" since it's stronger and from the point of
view of people's expectations of encryption, more accurate.

This is done in repsonse to the request/discussion at
#93
@michalc
Copy link
Member

michalc commented Jan 5, 2024

I'm going to now treat this as done. To summarise the changes...

The related PRs:

#94
#95
#96
#97

The main documentation change, which is now at:
https://stream-zip.docs.trade.gov.uk/advanced-usage/#password-protection-%2F-encryption

And release:
https://github.com/uktrade/stream-zip/releases/tag/v0.0.69
https://pypi.org/project/stream-zip/0.0.69/

If there are any problems, of course feel free to open an issue

@michalc michalc closed this as completed Jan 5, 2024
@mat-gas
Copy link

mat-gas commented Jun 26, 2024

Hi @michalc ,

would it be feasible to also add legacy zipcrypto to this lib? (not used by default when requesting encryption but feasible with a boolean parameter for example)

We propose downloading ZIP compressed files (executables that could be malwares) from our platform, and it's frequently consumed by python scripts (for instance to send to other platforms or sandboxes) which only support legacy crypto (stock python library only supports legacy ZIP crypto).

Those scripts frequently go through HTTP proxies that perform AV scans so we need the files to be encrypted (even if slightly with bad/legacy crypto).

Thanks in advance

@michalc
Copy link
Member

michalc commented Jun 29, 2024

@mat-gas,

Understood the requirement, but I'm torn about adding it: we have no use for it ourselves, and it's pretty much the opposite direction of travel that I had in mind in terms of security (not that this any sort of policy or anything, just a rough idea in my head). What would your course of action be if we don't add it?

Michal

@mat-gas
Copy link

mat-gas commented Jun 30, 2024

@michalc

we are currently using a mix of pyzipper and zipencrypt to support both legacy ZIP crypto and AES one (with legacy for API usage and AES when accessing through a browser), and we're also hand crafting streaming tar.gz archives when not encrypting stuff

this is kind of a historic mess and we'd very much like to rationalize everything and use a sole library (and switching from tar.gz to .zip file too) that meets all our features without removing already existing stuff (this would really annoy users that depends on the legacy zip crypto ecryption :( )

as we've recently stumbled on this particular issue (devthat/zipencrypt#2), this triggered a "we can do better and replace all this mess" process

What would our course of action be? no idea right now,

I completly understand that, in 2024, we should not implement weak crypto, but one of the main backend language out here (python) doesn't support "recent" stuff and we unfortunately need to accomodate this at work

@michalc
Copy link
Member

michalc commented Sep 28, 2024

@mat-gas Several months later and I realise I never replied to you.

I completly understand that, in 2024, we should not implement weak crypto

I think (maybe obviously by my lack of reply) I'm still not keen for this to go in. But also, looking at devthat/zipencrypt#2, at least in initial versions, it would probably hit a very similar performance issue since the encryption will probably use just pure Python.

, but one of the main backend language out here (python) doesn't support "recent" stuff and we unfortunately need to accomodate this at work

The one thing I can point you to (apologies if you know) is that the sibling library to this one, https://github.com/uktrade/stream-unzip, supports the decryption of AES-encrypted files in Python. Not sure if this will fit into your setup, e.g. it wouldn't if you don't have control over everywhere the file goes to, but it crossed my mind that you could have stream-zip generating the ZIPs, and then stream-unzip reading them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants