Archived Forum Post

Index of archived forum posts

Question:

How to encrypt indiviual files instead whole zip

Jan 27 '14 at 10:16

Greetings, sir, hope all are fine on this forum

i am working on zip project. Where i need to encrypt a file. but problem is if i use :

zip.Encryption, zip.EncryptKeyLength and zip.SetPassword it encrypts all the files (zipEntries) but i need to encrypt only individual files

for example:

a.txt

b.txt ( i like to encrypt this file only)

c.txt

hope i am clear (sorry for my bad English)

thanks in advance..

best regards


Answer

One way to do this is to create the .zip first unencrypted, containing only those files that are not to be encrypted. After that is written, create a new instance of the zip object and set the encryption related properties to what is desired. Then call QuickAppend to append encrypted entries to the already-existing unencrypted .zip.

Please realize though, that most Zip utility programs or software probably won't be able to handle .zip's containing both encrypted and unencrypted entries. Chilkat Zip, however, should be able to handle these without a problem.