@Override
protected void verify(final Path file, final MessageDigest digest, final Checksum checksum) throws ChecksumException {
if(null == digest) {
log.debug(String.format("Digest verification disabled for file %s", file));
return;
}
if(file.getType().contains(Path.Type.encrypted)) {
log.warn(String.format("Skip checksum verification for %s with client side encryption enabled", file));
return;
}
final String expected = Hex.encodeHexString(digest.digest());
if(!checksum.equals(Checksum.parse(expected))) {
throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()),
MessageFormat.format("Mismatch between {0} hash {1} of uploaded data and ETag {2} returned by the server",
checksum.algorithm.toString(), expected, checksum.hash));
}
}