Check signature of both DKIM and ARC headers

This commit is contained in:
M66B 2024-02-15 11:24:01 +01:00
parent a43d63b491
commit 08af779cef
1 changed files with 14 additions and 5 deletions

View File

@ -2238,8 +2238,17 @@ public class MessageHelper {
} }
// https://datatracker.ietf.org/doc/html/rfc6376/ // https://datatracker.ietf.org/doc/html/rfc6376/
String[] headers = amessage.getHeader(DKIM_SIGNATURE); List<String> headers = new ArrayList<>();
if (headers == null || headers.length < 1)
String[] dkim_headers = amessage.getHeader(DKIM_SIGNATURE);
if (dkim_headers != null && dkim_headers.length > 0)
headers.addAll(Arrays.asList(dkim_headers));
String[] arc_headers = amessage.getHeader(ARC_MESSAGE_SIGNATURE);
if (arc_headers != null && arc_headers.length > 0)
headers.addAll(Arrays.asList(arc_headers));
if (headers.size() == 0)
return signers; return signers;
for (String header : headers) { for (String header : headers) {
@ -2275,9 +2284,9 @@ public class MessageHelper {
else else
throw new IllegalArgumentException(n); throw new IllegalArgumentException(n);
headers = amessage.getHeader(n); String[] aheaders = amessage.getHeader(n);
if (headers != null) { if (aheaders != null) {
for (String header : headers) { for (String header : aheaders) {
Map<String, String> kv = getKeyValues(MimeUtility.unfold(header)); Map<String, String> kv = getKeyValues(MimeUtility.unfold(header));
Integer i = Helper.parseInt(kv.get("i")); Integer i = Helper.parseInt(kv.get("i"));
if (i == null || map.containsKey(i)) { if (i == null || map.containsKey(i)) {