Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Checking a zip’s password.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19385 |

    Is there any method in XCeed to check if a password matches to a specific string of characters? I would like to do a quick check of the zip files password before reading any of the files in the zip.

    Imported from legacy forums. Posted by rahsas (had 3460 views)

    User (Old forums)
    Member
    Post count: 23064

    I’d like to see this functionality too. Currently I attempt to open the zip file and react to the exception thrown.

    try{
    ZippedFile file = new ZippedFile(new DiskFile(filepath),filename.ToUpper(System.Globalization.CultureInfo.InvariantCulture));
    using(Stream s = file.OpenRead(FileShare.Read, password)){};
    }
    catch(InvalidDecryptionPasswordException e)
    {
    //invalid password
    }

    Imported from legacy forums. Posted by djcameron (had 215 views)

    User (Old forums)
    Member
    Post count: 23064

    Hey guys,

    Don’t know if you’ve resolved what you’re trying to do here, but I have an application that can use passwords, and from the component that wraps up the unzipping, I have something similar to you.

    What I do it throw an event in the catch, to get the password, then re-call that function with the same parameters, passing in the supplied password from the event. That seems to work nicely.

    I think what you need to do is actually try to read then open the first file in the zip file, into a memoryfolder (theres an example with the component).
    The process of reading as I understand it, won’t require a password, only extraction requires it. That’s my understand if that’s any help???

    Cheers,

    Martin.

    Imported from legacy forums. Posted by MartinPlatt (had 3485 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.