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

Mk/add support for extracting password protected LZMA(2) 7z archives #324

Merged

Conversation

@CharlieBP
Copy link
Contributor

@CharlieBP CharlieBP commented Dec 3, 2017

Added initial support for Password protected 7z (LZMA / LZMA2) archives and added unit tests to confirm the working.

@CharlieBP CharlieBP changed the title Mk/add seven zip aes support Mk/add support for extracting password protected LZMA(2) 7z archives Dec 3, 2017
@CharlieBP
Copy link
Contributor Author

@CharlieBP CharlieBP commented Dec 4, 2017

Possibly resolves #208

@adamhathcock
Copy link
Owner

@adamhathcock adamhathcock commented Dec 4, 2017

Looks great! Thanks.

@adamhathcock adamhathcock merged commit c2528cf into adamhathcock:master Dec 4, 2017
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@michalpenka
Copy link

@michalpenka michalpenka commented Mar 28, 2018

I have a few problems with the archive attached, password "password", created with 7zip 16.04. Had to zip it first to be able to upload it here:
LZMA.AES.7z.zip

Firstly, there is no way to test if archive is encrypted or not. The IsEncrypted property of all the entries is false. To explain a business case - often we get a list of 7z archives and a list of passwords - we need to try the passwords if needed.

Secondly, with password "fdsa" the first two file entries are "successfully" extracted to stream with no exception thrown. The content of these files is, however, still somehow encrypted. The third entry throws an exception.

Thirdly, the invalid password exception would be appreciated. Currently there is no way to catch SharpCompress exceptions as they are protected.

Finally, I have managed to work around the issues mentioned above by trying to extract all the entries into the temp stream first and catching any kind of exception. If no exception is thrown, I know I have a good password (if any). This is of course not ideal as we run through the extraction twice. Also, there is a risk that no exception will be thrown as observed with the first two entries.

Any comments/suggestions/fixes are appreciated.

Thanks for your efforts to support 7z.

@adamhathcock
Copy link
Owner

@adamhathcock adamhathcock commented Mar 28, 2018

Sounds like there could be some reworking of encryption handling. I think creating an issue is more valid here.

I need to check the zip spec but sometimes (maybe just RAR) you only know if the decryption worked if there's an exception. No other way to know if a password is valid.

@me-hungry
Copy link

@me-hungry me-hungry commented Jun 14, 2019

Any updates about how to check if .7z is encrypted or not?

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

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.