Cross checking password of zip file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dianuh
Forum Newbie
Posts: 1
Joined: Wed Jan 12, 2005 6:40 am

Cross checking password of zip file

Post by dianuh »

Is it possible to cross check password of zip file without opening it. Actually i am working on a project where a password protected zip file will be uploaded with a separate field where password will be given. after uploading of that file the password given in the form field will be cross checked with the password of the zip file.

So if there is any help it will be highly appreciated.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it should be possible.. how to do it, I have no idea. The Zip classes (2 links) posted in the Code Snippets forum may give some leads.. You may want to chat a bit with the author: redmonkey
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

You need to open the zip file in order to check the password is correct.

You need to get some info from within the file in order to check the password is correct.

Standard PKware encryption stores a 12byte encryption header with each file within the archive so you need to extract that. Once you have the header decrypted the last 1 (or 2) byte(s) is the high-order byte of the CRC checksum for the file (which you also need to extract) and you can use that to confirm the password is correct.
Post Reply