org.apache.james.jdkim
Class DKIMVerifier

java.lang.Object
  extended by org.apache.james.jdkim.DKIMCommon
      extended by org.apache.james.jdkim.DKIMVerifier

public class DKIMVerifier
extends DKIMCommon


Constructor Summary
DKIMVerifier()
           
DKIMVerifier(PublicKeyRecordRetriever publicKeyRecordRetriever)
           
 
Method Summary
static void apply(PublicKeyRecord pkr, SignatureRecord sign)
          asserts applicability of a signature record the a public key record.
protected  PublicKeyRecordRetriever getPublicKeyRecordRetriever()
           
 BodyHasher newBodyHasher(Headers messageHeaders)
           
protected  BodyHasherImpl newBodyHasher(SignatureRecord signRecord)
           
protected  PublicKeyRecord newPublicKeyRecord(String record)
           
 SignatureRecord newSignatureRecord(String record)
           
 PublicKeyRecord publicKeySelector(List<String> records)
           
 PublicKeyRecord publicRecordLookup(SignatureRecord sign)
          Iterates through signature's declared lookup method
 List<SignatureRecord> verify(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.
 List<SignatureRecord> verify(Headers messageHeaders, InputStream bodyInputStream)
          Verifies all of the DKIM-Signature records declared in the Headers object.
 List<SignatureRecord> verify(InputStream is)
          Verifies all of the DKIM-Signature records declared in the supplied input stream
 
Methods inherited from class org.apache.james.jdkim.DKIMCommon
signatureCheck, streamCopy, updateSignature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DKIMVerifier

public DKIMVerifier()

DKIMVerifier

public DKIMVerifier(PublicKeyRecordRetriever publicKeyRecordRetriever)
Method Detail

newPublicKeyRecord

protected PublicKeyRecord newPublicKeyRecord(String record)

newSignatureRecord

public SignatureRecord newSignatureRecord(String record)

newBodyHasher

protected BodyHasherImpl newBodyHasher(SignatureRecord signRecord)
                                throws PermFailException
Throws:
PermFailException

getPublicKeyRecordRetriever

protected PublicKeyRecordRetriever getPublicKeyRecordRetriever()
                                                        throws PermFailException
Throws:
PermFailException

publicKeySelector

public PublicKeyRecord publicKeySelector(List<String> records)
                                  throws PermFailException
Throws:
PermFailException

apply

public static void apply(PublicKeyRecord pkr,
                         SignatureRecord sign)
                  throws PermFailException
asserts applicability of a signature record the a public key record. throws an

Parameters:
pkr - public key record
sign - 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

Parameters:
sign - the signature record
Returns:
an "applicable" PublicKeyRecord
Throws:
TempFailException
PermFailException

verify

public List<SignatureRecord> verify(InputStream is)
                             throws IOException,
                                    FailException
Verifies all of the DKIM-Signature records declared in the supplied input stream

Parameters:
is - inputStream
Returns:
a list of verified signature records.
Throws:
IOException
FailException - if no signature can be verified

newBodyHasher

public BodyHasher newBodyHasher(Headers messageHeaders)
                         throws FailException
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.

Parameters:
messageHeaders - parsed headers
bodyInputStream - input stream for the body.
Returns:
a list of verified signature records
Throws:
IOException
FailException - if no signature can be verified

verify

public List<SignatureRecord> verify(BodyHasher bh)
                             throws FailException
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.

Parameters:
compoundBodyHasher - 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


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.