Does this support password-protected-archive unpacking (RAR/ZIP/TAR...) (mostly for RAR format)? #356

Closed
opened 2026-01-29 22:10:36 +00:00 by claunia · 3 comments
Owner

Originally created by @KillShot007 on GitHub (May 23, 2019).

I can't find the password argument in the RARArchive's open function

Originally created by @KillShot007 on GitHub (May 23, 2019). I can't find the password argument in the RARArchive's open function
Author
Owner
@adamhathcock commented on GitHub (May 23, 2019): https://github.com/adamhathcock/sharpcompress/blob/master/tests/SharpCompress.Test/Rar/RarArchiveTests.cs#L52
Author
Owner

@tardezyx commented on GitHub (Jan 6, 2020):

@adamhathcock
Your test code does not work. I've tried to decompress it with ArchiveFactory.Open and RarArchive.Open - with stream and with direct path. Neither worked.

Code is:

ReaderOptions ro = new ReaderOptions();
ro.Password = password;
ro.LeaveStreamOpen = true;

Stream stream = File.Open(path, FileMode.Open);
IArchive archive = RarArchive.Open(stream, ro);

foreach (IArchiveEntry entry in archive.Entries.Where(entry => !entry.IsDirectory))
{
	entry.WriteToDirectory(targetPath, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true });
}
archive.Dispose();
stream.Close();
stream.Dispose();
@tardezyx commented on GitHub (Jan 6, 2020): @adamhathcock Your test code does not work. I've tried to decompress it with ArchiveFactory.Open and RarArchive.Open - with stream and with direct path. Neither worked. Code is: ``` ReaderOptions ro = new ReaderOptions(); ro.Password = password; ro.LeaveStreamOpen = true; Stream stream = File.Open(path, FileMode.Open); IArchive archive = RarArchive.Open(stream, ro); foreach (IArchiveEntry entry in archive.Entries.Where(entry => !entry.IsDirectory)) { entry.WriteToDirectory(targetPath, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } archive.Dispose(); stream.Close(); stream.Dispose(); ```
Author
Owner

@adamhathcock commented on GitHub (Jan 6, 2020):

Funny because the tests run and pass.

RAR5 decryption is a TODO item.

@adamhathcock commented on GitHub (Jan 6, 2020): Funny because the tests run and pass. RAR5 decryption is a TODO item.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#356