jeantil commented on code in PR #2700:
URL: https://github.com/apache/james-project/pull/2700#discussion_r2038160965


##########
server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/DKIMSign.java:
##########
@@ -153,38 +149,23 @@ public void init() throws MessagingException {
 
     public void service(Mail mail) throws MessagingException {
         DKIMSigner signer = new DKIMSigner(getSignatureTemplate(), 
getPrivateKey());
-        SignatureRecord signRecord = signer
-                .newSignatureRecordTemplate(getSignatureTemplate());
-        try {
-            BodyHasher bhj = signer.newBodyHasher(signRecord);
-            MimeMessage message = mail.getMessage();
-            Headers headers = new MimeMessageHeaders(message);
-            try {
-                OutputStream os = new 
HeaderSkippingOutputStream(bhj.getOutputStream());
-                if (forceCRLF) {
-                    os = new CRLFOutputStream(os);
-                }
-                try (MimeMessageInputStream stream = new 
MimeMessageInputStream(message)) {
-                    stream.transferTo(os);
-                }
-            } catch (IOException e) {
-                throw new MessagingException("Exception calculating bodyhash: 
" + e.getMessage(), e);
-            } finally {
-                try {
-                    bhj.getOutputStream().close();
-                } catch (IOException e) {
-                    throw new MessagingException("Exception calculating 
bodyhash: " + e.getMessage(), e);
-                }
-            }
-            String signatureHeader = signer.sign(headers, bhj);
+        MimeMessage message = mail.getMessage();
+
+        try (MimeMessageInputStream stream = new 
MimeMessageInputStream(message)) {
+            String signatureHeader = forceCRLF ?
+                    signer.sign(new CRLFInputStream(stream)) :

Review Comment:
   the same applied for the verifier implementation



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to