I am sending a file to s3 bucket using camel. I want to verify the file integrity using md5. i am using org.apache.commons.codec.digest.DigestUtils
.
from(ftp_endpoint)
.idempotentConsumer(simple("${in.header.CamelFileName}"), redisIdempotentRepository)
.setHeader(S3Constants.KEY, simple("${file:name}"))
.setHeader(S3Constants.CONTENT_MD5, simple(DigestUtils.md5(body().toString()).toString()))
.to(s3_endpoint)
I am getting the following exception
com.amazonaws.services.s3.model.AmazonS3Exception: The Content-MD5 you specified was invalid.
(Service: Amazon S3; Status Code: 400; Error Code: InvalidDigest; Request ID: 8462458C6250091C)
How do i calculate the MD5 correctly so that it uploads to S3.