org.keyczar
Class TimeoutVerifier

java.lang.Object
  extended by org.keyczar.TimeoutVerifier
Direct Known Subclasses:
TimeoutSigner

public class TimeoutVerifier
extends java.lang.Object

TimeoutVerifiers verify timeout signatures generated by TimeoutSigner objects

Author:
steveweis@gmail.com (Steve Weis)

Constructor Summary
TimeoutVerifier(KeyczarReader reader)
          Initialize a new TimeoutVerifier with a KeyczarReader.
TimeoutVerifier(java.lang.String fileLocation)
          Initialize a new TimeoutVerifier with a key set location.
TimeoutVerifier(Verifier verifier)
          Initialize a new TimeoutVerifier with a Verifier object.
 
Method Summary
 boolean verify(byte[] data, byte[] signature)
          Verifies a timeout signature on the given byte array of data
 boolean verify(java.nio.ByteBuffer data, java.nio.ByteBuffer timeoutSignature)
          Verify the timeout signature on the given data
 boolean verify(java.lang.String data, java.lang.String signature)
          Verifies the timeout signature on the given String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeoutVerifier

public TimeoutVerifier(KeyczarReader reader)
                throws KeyczarException
Initialize a new TimeoutVerifier with a KeyczarReader. The corresponding key set must have a purpose KeyPurpose.VERIFY.

Parameters:
reader - A reader to read keys from
Throws:
KeyczarException - In the event of an IO error reading keys or if the key set does not have the appropriate purpose.

TimeoutVerifier

public TimeoutVerifier(java.lang.String fileLocation)
                throws KeyczarException
Initialize a new TimeoutVerifier with a key set location. This will attempt to read the keys using a KeyczarFileReader. The corresponding key set must have a purpose of KeyPurpose.VERIFY.

Parameters:
fileLocation - Directory containing a key set
Throws:
KeyczarException - In the event of an IO error reading keys or if the key set does not have the appropriate purpose.

TimeoutVerifier

public TimeoutVerifier(Verifier verifier)
Initialize a new TimeoutVerifier with a Verifier object.

Parameters:
verifier - Signer to be used for timeout signatures
Method Detail

verify

public boolean verify(java.lang.String data,
                      java.lang.String signature)
               throws KeyczarException
Verifies the timeout signature on the given String

Parameters:
data - The data to verify the signature on
signature - The signature to verify
Returns:
Whether this is a valid signature
Throws:
KeyczarException - If the signature is malformed or a JCE error occurs.

verify

public boolean verify(byte[] data,
                      byte[] signature)
               throws KeyczarException
Verifies a timeout signature on the given byte array of data

Parameters:
data - The data to verify the signature on
signature - The timeput signture to verify
Returns:
Whether this is a valid signature
Throws:
KeyczarException - If the signature is malformed or a JCE error occurs.

verify

public boolean verify(java.nio.ByteBuffer data,
                      java.nio.ByteBuffer timeoutSignature)
               throws KeyczarException
Verify the timeout signature on the given data

Parameters:
data -
timeoutSignature -
Returns:
A boolean value indicating whether the timeout signature verified. This will be false if the signature has expired.
Throws:
KeyczarException - If the signature is malformed or a JCE error occurs.