This is a migrated thread and some comments may be shown as answers.

Detect if Zip file is password protected

3 Answers 296 Views
ZipLibrary
This is a migrated thread and some comments may be shown as answers.
Yoshiaki
Top achievements
Rank 1
Yoshiaki asked on 23 Jun 2017, 07:40 PM

Hi,

I'd like to ask if there are ways to detect if the zip file is password protected. Just to give you a background of what I want to accomplish. I have a application that extract zip files. Zip files may be password protected and/or not password protected. By doing that, I will know if I will prompt a dialog box so that the user will enter the zip file password.

Initially, I tried to extract the file without the Encryption parameter to test if it can be extracted. Unfortunately, the files still get extracted only that it contains some funny characters.

using (ZipArchive zip = new ZipArchive(stream))
      {
                foreach (ZipArchiveEntry e in zip.Entries
                   {
                            using (Stream sw = File.Create(Path.Combine(FileDestination, e.FullName)))
                               {
                                    Stream enterySTream = e.Open();
                                   Telerik.WinControls.Zip.Extensions.ZipFile.CopyStreamTo(enterySTream, sw);
                                   sw.Flush();              
                            }
                     }
    }

I have the latest  Winforms Telerik version installed.

Thank you.

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Tanya
Telerik team
answered on 27 Jun 2017, 12:06 PM
Hi Yoshiaki,

A similar option is currently not available in ZipLibrary. We have it logged as a feature request in our public portal and you can vote for the implementation as well as subscribe to track its status using the related feedback item.

Regards,
Tanya
Progress Telerik

0
Yoshiaki
Top achievements
Rank 1
answered on 10 Jul 2017, 02:18 AM

Hi Tanya,

Thank you for you for confirming that this function is not available yet. I need it in my project urgently but I'm still looking forward in implementing this function in the future. 

Best Regards

 

0
Tanya
Telerik team
answered on 10 Jul 2017, 08:07 PM
Hi Yoshiaki,

Make sure you cast your vote for this functionality using the Like button of the item. Through the Follow this item button you can subscribe to receive notifications when the status of the task changes.

Regards,
Tanya
Progress Telerik

Tags
ZipLibrary
Asked by
Yoshiaki
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Yoshiaki
Top achievements
Rank 1
Share this question
or