Set password in zip files

General questions that have to do with plugins go here
Post Reply
User avatar
Juan Carlos
Posts: 502
Joined: Mon Sep 06, 2010 1:02 pm
Contact:

Set password in zip files

Post by Juan Carlos » Tue Sep 10, 2019 6:31 pm

I try to ziped a picture file with password and it or not works or I don't know how set it.

Code: Select all

@REQUIRE "zip", {InstallAdapter = True}

@DISPLAY {Title="Window", Width=640, Height=480}

zip.OpenArchive(1, "test.zip", #MODE_WRITE)

;zip.AddFile(1, "House.jpg") ;Here the code ziped the picture.

;Below the code where you choose the mode and password doesn't work.
zip.AddFile(1, "House.jpg", {#ZIP_EM_AES_256, #ZIP_CM_BZIP2})
zip.SetDefaultPassword(1, "Hello")

;This below line neither work.
;zip.SetFileEncryption(1, "House.jpg", {#ZIP_EM_AES_256, "Hola"})

zip.CloseArchive(1)

SystemRequest("Noticie", "File ziped", "Ok", #REQICON_INFORMATION)
End()

Where is the fault because there aren't examples to this and for make a little Hollyzip.

User avatar
airsoftsoftwair
Posts: 3121
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Set password in zip files

Post by airsoftsoftwair » Wed Sep 11, 2019 8:33 pm

You obviously don't pass the table arguments to zip.AddFile() correctly. The line should be:

Code: Select all

zip.AddFile(1, "House.jpg", {Encryption = #ZIP_EM_AES_256, Compression = #ZIP_CM_BZIP2})

User avatar
Juan Carlos
Posts: 502
Joined: Mon Sep 06, 2010 1:02 pm
Contact:

Re: Set password in zip files

Post by Juan Carlos » Wed Sep 11, 2019 9:52 pm

Sorry but only shows this message:
A zip error has occurred!
Even I added the field Password = "Hello" and also show the same message.
This is only to zip one file.

User avatar
airsoftsoftwair
Posts: 3121
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Set password in zip files

Post by airsoftsoftwair » Sun Sep 15, 2019 6:15 pm

Juan Carlos wrote:
Wed Sep 11, 2019 9:52 pm
Sorry but only shows this message:
A zip error has occurred!
Even I added the field Password = "Hello" and also show the same message.
This is only to zip one file.
Ok, looks like the zip plugin currently doesn't support bzip2. So just do the following and you're all set:

Code: Select all

zip.AddFile(1, "House.jpg", {Encryption = #ZIP_EM_AES_256})

User avatar
Juan Carlos
Posts: 502
Joined: Mon Sep 06, 2010 1:02 pm
Contact:

Re: Set password in zip files

Post by Juan Carlos » Mon Sep 16, 2019 10:52 am

Thank you, Andreas, now it works.

Post Reply