/** * @return * the Base64-encoded MD5 hash of an object's data contents as stored in the metadata * item <code>Content-MD5</code>, or as derived from an <code>ETag</code> or * <code>md5-hash</code> hex-encoded version of the hash. Returns null if the hash value is not * available. */ public String getMd5HashAsBase64() { String md5HashBase64 = (String) getMetadata(METADATA_HEADER_CONTENT_MD5); if (md5HashBase64 == null) { // Try converting the object's ETag (a hex-encoded md5 hash). final String eTag = getETag(); if (eTag != null && ServiceUtils.isEtagAlsoAnMD5Hash(eTag)) { return ServiceUtils.toBase64(ServiceUtils.fromHex(eTag)); } // Try converting the object's md5-hash (another hex-encoded md5 hash). if (getMd5HashAsHex() != null) { return ServiceUtils.toBase64(ServiceUtils.fromHex(getMd5HashAsHex())); } } return md5HashBase64; }
/** * @return * the Base64-encoded MD5 hash of an object's data contents as stored in the metadata * item <code>Content-MD5</code>, or as derived from an <code>ETag</code> or * <code>md5-hash</code> hex-encoded version of the hash. Returns null if the hash value is not * available. */ public String getMd5HashAsBase64() { String md5HashBase64 = (String) getMetadata(METADATA_HEADER_CONTENT_MD5); if (md5HashBase64 == null) { // Try converting the object's ETag (a hex-encoded md5 hash). final String eTag = getETag(); if (eTag != null && ServiceUtils.isEtagAlsoAnMD5Hash(eTag)) { return ServiceUtils.toBase64(ServiceUtils.fromHex(eTag)); } // Try converting the object's md5-hash (another hex-encoded md5 hash). if (getMd5HashAsHex() != null) { return ServiceUtils.toBase64(ServiceUtils.fromHex(getMd5HashAsHex())); } } return md5HashBase64; }
if (!hexMD5OfDownloadedData.equals(object.getMd5HashAsHex())) { if (log.isWarnEnabled()) { log.warn("Unable to verify MD5 hash of downloaded data against"
if (!hexMD5OfDownloadedData.equals(object.getMd5HashAsHex())) { if (log.isWarnEnabled()) { log.warn("Unable to verify MD5 hash of downloaded data against"