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

[Feature Request]: Adding a function to determine whether the metadata is encrypted #164

Closed
1 task done
ygqs250 opened this issue Aug 28, 2023 · 2 comments
Closed
1 task done
Assignees
Milestone

Comments

@ygqs250
Copy link

ygqs250 commented Aug 28, 2023

Feature description

Adding a function to determine whether the metadata is encrypted? Now bit7z can only use exceptions to determine whether the metadata is encrypted.

Additional context

No response

Code of Conduct

@rikyoz
Copy link
Owner

rikyoz commented Aug 28, 2023

Hi!

Thanks for the suggestion!

I've just pushed a commit (d194234) that adds two static functions to the BitArchiveReader class:

template< typename T >
auto BitArchiveReader::isHeaderEncrypted( const Bit7zLibrary& lib,
                                          T&& in_archive,
                                          const BitInFormat& format ) -> bool;

template< typename T >
auto BitArchiveReader::isEncrypted( const Bit7zLibrary& lib,
                                    T&& in_archive,
                                    const BitInFormat& format ) -> bool;

They're template functions so that they can accept either a file path (string), a buffer, or a standard stream of the archive to be checked.

BitArchiveReader::isHeaderEncrypted checks whether the archive is fully encrypted (header included), and hence it needs a password to be opened.

BitArchiveReader::isEncrypted checks whether the archive contains only encrypted files, but can be opened without a password (plain headers).

These functions will be included in the stable version of bit7z v4.

@rikyoz
Copy link
Owner

rikyoz commented Oct 1, 2023

Implemented in v4.0.0.

@rikyoz rikyoz closed this as completed Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants