Skip to content

Add archive-level password protection flags for 7z and rar#1060

Merged
adamhathcock merged 4 commits intoadamhathcock:masterfrom
HeroponRikiBestest:rar-7z-password
Dec 3, 2025
Merged

Add archive-level password protection flags for 7z and rar#1060
adamhathcock merged 4 commits intoadamhathcock:masterfrom
HeroponRikiBestest:rar-7z-password

Conversation

@HeroponRikiBestest
Copy link
Contributor

Adds an encrypted flag for 7z archives and rar archives. The main reason/utility of this PR is because ExtractAllEntries is (practically) needed for solid 7z and rar archives, but an exception will be thrown if any of the files are password protected. This avoids the current requirement to pre-iterate through file entries to check for password protection.

This implementation mainly copies the logic for 7z's IsEncrypted flag. It checks the first file in the archive and checks whether it's encrypted. While it's technically possible that some later files aren't encrypted; as mentioned previously, the main utility of this flag is so that the aforementioned additional logic can be avoided for solid archives.

This also lines up with #203 (comment) , where it was suggested that the most reliable way to check for password protection is to check the entry anyways.

Copy link
Owner

@adamhathcock adamhathcock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks simple and can be built upon, thanks!

@adamhathcock
Copy link
Owner

looks like you need to run csharpier

@HeroponRikiBestest
Copy link
Contributor Author

HeroponRikiBestest commented Dec 3, 2025

Ran csharpier on all changed files, let me know if I missed anything

@adamhathcock adamhathcock merged commit 2a3086a into adamhathcock:master Dec 3, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants

Comments