Details
-
Question
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Trying to verify the DKIM bh value for an email using verify method from tests.
protected static List<SignatureRecord> verify(DKIMVerifier verifier, MimeMessage message, boolean forceCRLF)
throws MessagingException, FailException {
Headers headers = new MimeMessageHeaders(message);
BodyHasher bh = verifier.newBodyHasher(headers);
try {
if (bh != null)
} catch (IOException e)
{ throw new MessagingException("Exception calculating bodyhash: " + e.getMessage(), e); } return verifier.verify(bh);
}
Created DKIMVerifier with a PublicKeyRecordRetriever. Call verify method with following:
verify(new DKIMVerifier(pkr), new MimeMessage(Session.getDefaultInstance(new Properties()), new ByteArrayInputStream(str.getBytes())), false);
str is a String with all of the source (headers and content) of an email.
verify throws error "Header signature does not verify" from line with "BodyHasher bh = verifier.newBodyHasher(headers);".
The only place in codebase where DKIMVerify.verify is used is in DKIMSignTest which uses a MockPublicKeyRecordRetriever.
What is incorrect with implementation?
Thanks.