Zip passwords not working in gman.zipengine

BlitzMax Forums/BlitzMax Programming/Zip passwords not working in gman.zipengine

JoshK(Posted 2012) [#1]
Save this file as "zipdemo.bmx" and run it. The BlitzMax program is able to extract the password-protected file from the created zip archive, but Windows Explorer and WinRar both say the password is wrong, when I enter the password "gman":
Framework BRL.Basic

Import gman.zipengine

Const password:String="gman"

' Create our zipwriter object
Local zwObject:ZipWriter = New ZipWriter
Local zrObject:ZipReader = New ZipReader

'Compress one file with password
If ( zwObject.OpenZip("data.zip", False) ) Then
	zwObject.AddFile("zipdemo.bmx", password)
	zwObject.CloseZip()
EndIf

' Password Example 2
' Open the zip file we just created and extract
' a file
If ( zrObject.OpenZip("data.zip") ) Then
	Print("filecount: "+zrObject.getFileCount())
	
	' display file information
	For Local i:Int=0 To zrObject.getFileCount()-1
		Print("filename: "+zrObject.getFileInfo(i).zipFileName)
		Print("simplefilename: "+zrObject.getFileInfo(i).simpleFileName)
		Print("path: "+zrObject.getFileInfo(i).path)
		Print("orig size: "+zrObject.getFileInfo(i).header.DataDescriptor.uncompressedsize)
		Print("comp size: "+zrObject.getFileInfo(i).header.DataDescriptor.compressedsize)
	Next
	zrObject.ExtractFileToDisk("zipdemo.bmx", "extracted_zipdemo_pass.bmx", False, password)
	zrObject.CloseZip()
EndIf


Last edited 2012


Rixarn(Posted 2012) [#2]
Hi Josh,

Have you tried 7zip? I use that program to open gman's created zip files.


Grisu(Posted 2012) [#3]
Are you using the lasted version 2.14?

Don't know how often GMan checks in here. So you might want to contact him via his forum: http://www.gprogs.com/viewforum.php?id=8


gman(Posted 2012) [#4]
greetings :) i implemented the ecryption from the same guy that wrote the rest of the C library. in his crypt header he has:

This code support the "Traditional PKWARE Encryption".

The new AES encryption added on Zip format by Winzip (see the page
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
Encryption is not supported.


i would guess that is the issue. i looked for alternative crypt routines for zlib but was not able to find anything. i did find an alternative library that has potential to be used by BMax (Info-ZIP) but I just don't have the time right now to try to tackle it.


JoshK(Posted 2012) [#5]
Unless that was written a very long time ago, I would be surprised if this was causing a problem.


gman(Posted 2012) [#6]
greetings :) i have made an update to the ZipEngine module to fix an issue with the CRC and passwords. It resolved the issue for me in XP using the windows explorer extract. Please try the new module and let me know how it goes:

2012-03-23 v2.15 ZipEngine Module

on a side, a big thank you for inadvertantly providing the solution in the CRC ZipEngine thread!

Last edited 2012


JoshK(Posted 2012) [#7]
It appears to work. Thanks!


JoshK(Posted 2012) [#8]
I'm not sure why, but your library has become unusably slow. I had to revert to an older version because it makes my program take one minute to start. All it does at startup is read all the file path names.

Last edited 2012