验证受密码保护的 ZIP 文件

Validating password protected ZIP files

我正在使用 Zip4j 打包 ZIP 个文件。有时,创建的 ZIP 文件似乎通过 FTP 被(上传)损坏,所以我想验证它。

here don't work because they cause an exception on password protected archives by default since the default Java ZipFile 中的代码片段不支持密码保护。

通常的哈希验证怎么样?

  1. 创建您的 ZIP
  2. 计算其 md5(DigestUtils 来自 commons-digest 可能被使用)
  3. 上传 ZIP
  4. 在文本文件中上传哈希
  5. 在接收端,用md5重新散列,与接收到的MD5进行比较