|
Post by Stefan on Nov 15, 2004 14:10:41 GMT -5
Hi! How ca i check wether a file in the zip achive is password protected or not? unfortunately the Help does not give very much helb here... I tried it this way: test1 := DecryptHeaderByte(trim(passEdit.Text), DecryptHeader[1]); if (test1 = 88) then "file ist password protected"... During my first tries alle protected files resultet 88 so I thought this would mean "this file is password protected"... But now I get some other results for potectet files... So, what can I do? Tanks a lot! Stefan
|
|
|
Post by Kevin on Nov 16, 2004 6:39:38 GMT -5
Use the indexed property isEncrypted to determine wheter a particular compressed file is password protected.
Kevin
|
|
|
Post by Stefan on Dec 17, 2004 4:40:03 GMT -5
Sorry, I aked the wrong question. I what to know, who I can test wether an given password is correct or not...
I tried it this way:
test1 := DecryptHeaderByte(trim(passEdit.Text), DecryptHeader[1]);
if (test1 = 88) then "file ist password protected"...
88 because I found out (a thought so) , that DecryptHeaderByte returns 88 if the password was correct, but that is not true.
So how can I check a password without unzipping a file?
Thanks Stefan
So
|
|
|
Post by Kevin on Dec 17, 2004 16:51:29 GMT -5
Because of the way PKZip encryption works, there may be several passwords that match the stored key but only one will allow the file to be unzipped correctly. The only way to know if a password is correct for sure is by unzipping the file and if the password is incorrect the OnBadPassword event will be called.
Kevin
|
|