Not possible to supply a password when using the high level interfaces #24

Open
opened 2026-01-29 22:03:39 +00:00 by claunia · 4 comments
Owner

Originally created by @ptallett on GitHub (Dec 26, 2014).

When processing a password protected ZIP file using the high level IArchiveReader/Writer interfaces, it is not possible to supply the password as this functionality is only exposed by lower level interfaces.

Cheers,
Paul

Originally created by @ptallett on GitHub (Dec 26, 2014). When processing a password protected ZIP file using the high level IArchiveReader/Writer interfaces, it is not possible to supply the password as this functionality is only exposed by lower level interfaces. Cheers, Paul
Author
Owner

@sepehr1014 commented on GitHub (May 31, 2015):

Any plans on adding this functionality?

@sepehr1014 commented on GitHub (May 31, 2015): Any plans on adding this functionality?
Author
Owner

@ptallett commented on GitHub (May 31, 2015):

Its fairly easy to hack this. I just put a static string in the lower level class and a set method in the high level API. Not something I’m proud of though, so I didn’t check it in! :)

Cheers,

Paul

From: Sepehr Mohammad [mailto:notifications@github.com]
Sent: Sunday, May 31, 2015 10:49
To: adamhathcock/sharpcompress
Cc: ptallett
Subject: Re: [sharpcompress] Not possible to supply a password when using the high level interfaces (#37)

Any plans on adding this functionality?


Reply to this email directly or view it on GitHub https://github.com/adamhathcock/sharpcompress/issues/37#issuecomment-107150857 . https://github.com/notifications/beacon/AJ1R_ZJ-1emnOasyNrm8k2yfHfDAOJbeks5oOtCRgaJpZM4DMah1.gif

@ptallett commented on GitHub (May 31, 2015): Its fairly easy to hack this. I just put a static string in the lower level class and a set method in the high level API. Not something I’m proud of though, so I didn’t check it in! :) Cheers, Paul From: Sepehr Mohammad [mailto:notifications@github.com] Sent: Sunday, May 31, 2015 10:49 To: adamhathcock/sharpcompress Cc: ptallett Subject: Re: [sharpcompress] Not possible to supply a password when using the high level interfaces (#37) Any plans on adding this functionality? — Reply to this email directly or view it on GitHub https://github.com/adamhathcock/sharpcompress/issues/37#issuecomment-107150857 . https://github.com/notifications/beacon/AJ1R_ZJ-1emnOasyNrm8k2yfHfDAOJbeks5oOtCRgaJpZM4DMah1.gif
Author
Owner

@sepehr1014 commented on GitHub (May 31, 2015):

Thanks @ptallett but in our situation, we don't know if the files are password protected beforehand. There needs to be an event which is raised on password protected archives to get the password and continue extracting.

@sepehr1014 commented on GitHub (May 31, 2015): Thanks @ptallett but in our situation, we don't know if the files are password protected beforehand. There needs to be an event which is raised on password protected archives to get the password and continue extracting.
Author
Owner

@ptallett commented on GitHub (Jun 1, 2015):

Yes, that would be ideal, but you can workaround it by trying to open the ZIP file without a password, catching the exception, requesting a password, then retrying to open the ZIP file. Works a treat. You need to do something similar if the password is incorrect in any case.

The drawback with this approach is each file in a ZIP container can have a different password, but I just ignored that scenario as its rare.

Cheers,

Paul

From: Sepehr Mohammad [mailto:notifications@github.com]
Sent: Sunday, May 31, 2015 12:12
To: adamhathcock/sharpcompress
Cc: ptallett
Subject: Re: [sharpcompress] Not possible to supply a password when using the high level interfaces (#37)

Thanks @ptallett https://github.com/ptallett but in our situation, we don't know if the files are password protected beforehand. There needs to be an event which is raised on password protected archives to get the password and continue extracting.


Reply to this email directly or view it on GitHub https://github.com/adamhathcock/sharpcompress/issues/37#issuecomment-107156870 . https://github.com/notifications/beacon/AJ1R_cZI5fKKhyK6qAn62WW8EqO1AIr7ks5oOuPkgaJpZM4DMah1.gif

@ptallett commented on GitHub (Jun 1, 2015): Yes, that would be ideal, but you can workaround it by trying to open the ZIP file without a password, catching the exception, requesting a password, then retrying to open the ZIP file. Works a treat. You need to do something similar if the password is incorrect in any case. The drawback with this approach is each file in a ZIP container can have a different password, but I just ignored that scenario as its rare. Cheers, Paul From: Sepehr Mohammad [mailto:notifications@github.com] Sent: Sunday, May 31, 2015 12:12 To: adamhathcock/sharpcompress Cc: ptallett Subject: Re: [sharpcompress] Not possible to supply a password when using the high level interfaces (#37) Thanks @ptallett https://github.com/ptallett but in our situation, we don't know if the files are password protected beforehand. There needs to be an event which is raised on password protected archives to get the password and continue extracting. — Reply to this email directly or view it on GitHub https://github.com/adamhathcock/sharpcompress/issues/37#issuecomment-107156870 . https://github.com/notifications/beacon/AJ1R_cZI5fKKhyK6qAn62WW8EqO1AIr7ks5oOuPkgaJpZM4DMah1.gif
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#24