Co třeba nějak takhle?
public static boolean verifyZipPassword(ZipFile zipFile, String password) {
try {
Enumeration<ZipArchiveEntry> entries = zipFile.getEntries();
ZipArchiveEntry smallestEntry = null;
while (entries.hasMoreElements()) {
ZipArchiveEntry entry = entries.nextElement();
if (smallestEntry == null || entry.getSize() < smallestEntry.getSize()) {
smallestEntry = entry;
}
}
if (smallestEntry != null) {
return zipFile.canReadEntryData(smallestEntry, password);
}
return true;
} catch (IOException e) {
return false;
}
}