简体   繁体   中英

Creating Password Protected ZIP using Java

I trying to create ZIP file with password protection. But available libraries protecting the Files inside the ZIP. I have tried Zip4j and AesZipFileEncrypter but all these protecting the files only not the ZIP file. The code mentioned in the Question is also Zipping the files only. Stack Overflow Question .

"http://code.google.com/p/winzipaes/"

This API helps to add a password to a already created zip file. It means that if you want to create a password protected zip file, first you have to create a zip file and then you can add a password that zip file. It is a pure java API works with any operating system. You have to download the following jar file from the above URL.

It is because Zip-encrypted file is a Zip, with inside files encrypted. details of encryption (algorithm, ...) is kept inside zip format.

The ZIP APIs manage that.

What you want is an encrypted file (independent of content which is Zip).

1 To do that, you can use many methods and algorithms like this:

How to encrypt and decrypt files with bouncy castle (DES) in netbeans java?

2 but result will not be recognized as zip file, then usual tools wont work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM