Package org.apache.james.jdkim
Class DKIMVerifierImpl
java.lang.Object
org.apache.james.jdkim.DKIMCommon
org.apache.james.jdkim.DKIMVerifierImpl
- All Implemented Interfaces:
DKIMVerifier
- Direct Known Subclasses:
IscheduleDKIMVerifier
-
Field Summary
FieldsFields inherited from class org.apache.james.jdkim.DKIMCommon
deepDebug -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddStoredKey(String domain, String selector, String key) Save a stored key for private-exchangestatic voidapply(PublicKeyRecord pkr, SignatureRecord sign) asserts applicability of a signature record the a public key record.static voidClear any keys stored for private-exchangeprotected PublicKeyRecordRetrievernewBodyHasher(Headers messageHeaders) protected BodyHasherImplnewBodyHasher(SignatureRecord signRecord) protected PublicKeyRecordnewPublicKeyRecord(String record) newSignatureRecord(String record) publicKeySelector(List<String> records) Iterates through signature's declared lookup methodverify(InputStream is) Verifies all of the DKIM-Signature records declared in the supplied input streamverify(BodyHasher bh) Completes the simultaneous verification of multiple signatures given the previously prepared compound body hasher where the user already written the body to the outputstream and closed it.verify(Headers messageHeaders, InputStream bodyInputStream) Verifies all of the DKIM-Signature records declared in the Headers object.Methods inherited from class org.apache.james.jdkim.DKIMCommon
debugMsg, signatureCheck, streamCopy, trace, updateSignature
-
Field Details
-
allowableFutureSeconds
protected int allowableFutureSeconds
-
-
Constructor Details
-
DKIMVerifierImpl
public DKIMVerifierImpl() -
DKIMVerifierImpl
-
-
Method Details
-
clearStoredKeys
public static void clearStoredKeys()Clear any keys stored for private-exchange -
addStoredKey
Save a stored key for private-exchange- Parameters:
domain- as per specselector- as per speckey- as per spec
-
newPublicKeyRecord
-
newSignatureRecord
- Specified by:
newSignatureRecordin interfaceDKIMVerifier
-
newBodyHasher
- Throws:
PermFailException
-
getPublicKeyRecordRetriever
- Throws:
PermFailException
-
publicKeySelector
- Specified by:
publicKeySelectorin interfaceDKIMVerifier- Throws:
PermFailException
-
apply
asserts applicability of a signature record the a public key record. throws an- Parameters:
pkr- public key recordsign- signature record- Throws:
PermFailException- when the keys are not applicable
-
publicRecordLookup
public PublicKeyRecord publicRecordLookup(SignatureRecord sign) throws TempFailException, PermFailException Iterates through signature's declared lookup method- Specified by:
publicRecordLookupin interfaceDKIMVerifier- Parameters:
sign- the signature record- Returns:
- an "applicable" PublicKeyRecord
- Throws:
TempFailException- on errorPermFailException- on error
-
verify
Verifies all of the DKIM-Signature records declared in the supplied input stream- Specified by:
verifyin interfaceDKIMVerifier- Parameters:
is- inputStream- Returns:
- a list of verified signature records.
- Throws:
IOException- if errorFailException- if no signature can be verified
-
newBodyHasher
- Specified by:
newBodyHasherin interfaceDKIMVerifier- Throws:
FailException
-
verify
public List<SignatureRecord> verify(Headers messageHeaders, InputStream bodyInputStream) throws IOException, FailException Verifies all of the DKIM-Signature records declared in the Headers object.- Specified by:
verifyin interfaceDKIMVerifier- Parameters:
messageHeaders- parsed headersbodyInputStream- input stream for the body.- Returns:
- a list of verified signature records
- Throws:
IOException- on io errorFailException- if no signature can be verified
-
verify
Completes the simultaneous verification of multiple signatures given the previously prepared compound body hasher where the user already written the body to the outputstream and closed it.- Specified by:
verifyin interfaceDKIMVerifier- Parameters:
bh- the BodyHasher previously obtained by this class.- Returns:
- a list of valid (verified) signatures or null on null input.
- Throws:
FailException- if no valid signature is found
-