Mk/add support for extracting password protected LZMA(2) 7z archives - #324
Conversation
|
Possibly resolves #208 |
|
Looks great! Thanks. |
|
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: 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. |
|
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. |
|
Any updates about how to check if .7z is encrypted or not? |
Added initial support for Password protected 7z (LZMA / LZMA2) archives and added unit tests to confirm the working.