title: How to check if file is password protected & password passed by user is correct or not using dotnetzip in c#
body: <p>In My application I am using DotNetZip to Zip &amp; UnZip files.
  Before Extracting files I want to know if password provided is correct or not.
  Right now I am doing it like this.</p>
  
  <pre><code>foreach (var sourceFile in sourceFileNames) {
   ZipFile file = ZipFile.Read(sourceFile);
   foreach (ZipEntry entry in file.Entries) {
      if (FileSystem.Exists(conf.Target + entry.FileName)) {
         FileSystem.Delete(conf.Target + entry.FileName);
      }
      if (!string.IsNullOrEmpty(conf.Password)) {
         entry.Password = conf.Password;
      }
         entry.Extract(conf.Target);
   }
  }
  </code></pre>
  
  <p>Here 'sourceFileNames' contains list of zip files</p>
  
  <p>If password is wrong or not provided then then It will give error but I do not want to do Like this.</p>
  
  <p>What I want to do is first check passwords for each zip file &amp; if all zip file has correct password then only extract them all.</p>