I was trying to upload an file to AWS S3 using an rest api by sigv4, as per documentation I have configured everything, it was working when I upload an txt file but problem was when I upload an image or pdf it throws an error The Content-MD5 you specified is not valid in java, below is the code I tried
<code> MessageDigest md = MessageDigest.getInstance("MD5");
md.update(content);
byte[] digest = md.digest();StringBuffer sb = new StringBuffer();
System.out.println(sb.toString());
byte [] bytes = org.apache.commons.codec.binary.Base64.encodeBase64(digest);
String finalString = new String(bytes);
return finalString;
</code>
<code> MessageDigest md = MessageDigest.getInstance("MD5");
md.update(content);
byte[] digest = md.digest();StringBuffer sb = new StringBuffer();
System.out.println(sb.toString());
byte [] bytes = org.apache.commons.codec.binary.Base64.encodeBase64(digest);
String finalString = new String(bytes);
return finalString;
</code>
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(content);
byte[] digest = md.digest();StringBuffer sb = new StringBuffer();
System.out.println(sb.toString());
byte [] bytes = org.apache.commons.codec.binary.Base64.encodeBase64(digest);
String finalString = new String(bytes);
return finalString;
please let me know you are thoughts
The Content-MD5 you specified is not valid in java and springboot,,,
I am uploading an multipart file from postman to springboot api
3