Native DKIM: process body text length

This commit is contained in:
M66B 2023-02-14 08:22:17 +01:00
parent 1ab550206e
commit e8a8e483da
1 changed files with 9 additions and 0 deletions

View File

@ -2132,6 +2132,15 @@ public class MessageHelper {
} else
throw new IllegalArgumentException(c[1]);
String length = kv.get("l");
if (!TextUtils.isEmpty(length) && TextUtils.isDigitsOnly(length)) {
int l = Integer.parseInt(length);
if (l < 100)
throw new IllegalArgumentException("Body length " + l + " < 100");
if (l < body.length())
body = body.substring(0, l);
}
Log.i("DKIM body=" + body.replace("\r\n", "|"));
byte[] bh = MessageDigest.getInstance(halgo).digest(body.getBytes()); // TODO: charset?