in main/src/main/java/org/apache/james/jdkim/DKIMVerifier.java [123:151]
public static void apply(PublicKeyRecord pkr, SignatureRecord sign) throws PermFailException {
try {
if (!pkr.getGranularityPattern().matcher(sign.getIdentityLocalPart())
.matches()) {
throw new PermFailException("inapplicable key identity local="
+ sign.getIdentityLocalPart() + " Pattern: "
+ pkr.getGranularityPattern().pattern(), sign);
}
if (!pkr.isHashMethodSupported(sign.getHashMethod())) {
throw new PermFailException("inappropriate hash for a="
+ sign.getHashKeyType() + "/" + sign.getHashMethod(), sign);
}
if (!pkr.isKeyTypeSupported(sign.getHashKeyType())) {
throw new PermFailException("inappropriate key type for a="
+ sign.getHashKeyType() + "/" + sign.getHashMethod(), sign);
}
if (pkr.isDenySubdomains()) {
if (!sign.getIdentity().toString().toLowerCase().endsWith(
("@" + sign.getDToken()).toLowerCase())) {
throw new PermFailException(
"AUID in subdomain of SDID is not allowed by the public key record.", sign);
}
}
} catch (IllegalStateException e) {
throw new PermFailException("Invalid public key: " + e.getMessage(), sign);
}
}