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

Does zipzap support password encryption? #26

Open
lynnyzhang opened this issue Mar 15, 2013 · 15 comments
Open

Does zipzap support password encryption? #26

lynnyzhang opened this issue Mar 15, 2013 · 15 comments

Comments

@lynnyzhang
Copy link

My project needs the ability to delete/replace a file entry in an zip archive, but also need to support password. Does zipzap support password? If not, is it on the road map to support in a near future?

@pixelglow
Copy link
Owner

I currently have no plans to add password encryption, but the library should be flexible enough to add the "traditional" zip-based encryption. If you or anyone wants to attempt this, I'll certainly review the pull request. Alternatively, you can contact me at glen low at pixelglow dot com if you're willing to contract me for this.

As for the strong encryption option, it appears to be covered by some PKWARE patents, requires an additional license and may not be appropriate for an open-source project.

See the zip file format specification for more details.

@stuffmc
Copy link

stuffmc commented Jul 14, 2013

Might be related: #38

@pixelglow
Copy link
Owner

We have a working password decryption in place, thanks to @danielgindi, see #49.

@stuffmc
Copy link

stuffmc commented Jan 3, 2014

Great! I'll be looking forward to use it as soon as I need it again.

@danielgindi
Copy link
Contributor

AES may be also supported soon, if I actually find the time for it :-)

@danielgindi
Copy link
Contributor

Update - AES is in a pull request.
Encryptions should be relatively easy to implement now, using the same core functions (just in the other direction).

@danielgindi
Copy link
Contributor

AES decryption is now available in the master branch.

@cyupa
Copy link

cyupa commented Feb 12, 2014

Any update on encryption?
I figured out why I was having that file that wasn't encrypted :-)

@cyupa
Copy link

cyupa commented Feb 12, 2014

And also... In ZZAESDecryptInputStream.mm I see this method call:

CCCryptorCreate(kCCEncrypt,
 kCCAlgorithmAES,
 kCCOptionECBMode,
 derivedKey,
 keyLength,
 NULL,
&_aes);

Shouldn't the first parameter be: kCCDecrypt? Because you are decrypting those files. That's what I understand from a quick look over the CommonCryptor.h file.

@danielgindi
Copy link
Contributor

No, I guess that is why it did not work for us earlier, we tried with
kCCDecrypt. AES is symmetric, and the algorithm that CC runs on kCCDecrypt
does not suit the method that WinZip takes.

On Wed, Feb 12, 2014 at 6:27 PM, cyupa [email protected] wrote:

And also... In ZZAESDecryptInputStream.mm I see this method call:

CCCryptorCreate(kCCEncrypt,
kCCAlgorithmAES,
kCCOptionECBMode,
derivedKey,
keyLength,
NULL,
&_aes);

Shouldn't the first parameter be: kCCDecrypt? Because you are decrypting
those files. That's what I understand from a quick look over the
CommonCryptor.h file.


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-34885973
.

@cyupa
Copy link

cyupa commented Feb 12, 2014

I'll also have a look on it and see what I can do about it. Sadly, my knowledge on zip files and their file headers is near to none.

@danielgindi
Copy link
Contributor

If I understand you correctly, what you are missing really is encryption
instead of decryption? I might implement that soon

On Wed, Feb 12, 2014 at 6:51 PM, cyupa [email protected] wrote:

I'll also have a look on it and see what I can do about it. Sadly, my
knowledge on zip files and their file headers is near to none.


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-34888813
.

@cyupa
Copy link

cyupa commented Feb 12, 2014

Yes. The decryption works ok, and indeed it seems that it works with kCCEncrypt instead of kCCDecrypt. The file I uploaded yesterday (if I remember correctly) was created with zipzap. But I somehow overlooked the fact that there was no ZZAESEncryptionOutputStream and no encryption.

Because I need that, I'm willing to look into it, as far as I can go, and try to implement it.

@pixelglow
Copy link
Owner

@cyupa, @danielgindi -- I would definitely appreciate an encryption implementation! Do note we probably have to refactor the stream classes for encryption in the same style as the ones we did for decryption.

As for using kCCEncrypt in the CCCryptorCreate call, this is because we're implementing the CTR mode, which is a two-step process. The first step is to create a keystream by encrypting sequential numbers. The second step is to XOR this keystream with the ciphertext to produce the plaintext (decryption) or vice versa (encryption).

@inPhilly
Copy link

Any word on creating password protected zip files? (I have no knowledge of programming in this area or I would readily contribute)

macguru pushed a commit to ulyssesapp/zipzap that referenced this issue Jul 18, 2020
…s to feature/docx

* commit '74ff4bf1d7fb140aa78ec097d20e517835d3bc82':
  Fixes missing content types
  Adds missing documentation to image writer
  Updates missing file from last commit
  Improves content type handling for images
  Fixes small typo
  Adds support for page numbers
  Adds test for page number placeholder
  Restructures the xml boilderplate for images (ULYSSES-4822)
  Adds support for images
  Adds test cases for image support
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

6 participants