BullyWiiPlaza
BullyWiiPlaza

Reputation: 19185

Validating password protected ZIP files

I'm packing ZIP files using Zip4j. Sometimes, the created ZIP file seems to be (uploaded) corrupted via FTP so I would like to validate it.

The code snippets from here don't work because they cause an exception on password protected archives by default since the default Java ZipFile doesn't support password protections.

Upvotes: 0

Views: 301

Answers (1)

Roman Puchkovskiy
Roman Puchkovskiy

Reputation: 11835

How about the usual hash validation?

  1. Create your ZIP
  2. Calculate its md5 (DigestUtils from commons-digest may be used)
  3. Upload the ZIP
  4. Upload the hash in a text file
  5. On the receiving side, rehash it with md5 and compare with the received MD5

Upvotes: 1

Related Questions