org.keyczar
Class TimeoutSigner

java.lang.Object
  extended by org.keyczar.TimeoutVerifier
      extended by org.keyczar.TimeoutSigner

public class TimeoutSigner
extends TimeoutVerifier

Timeout signers can generate signatures that are valid until a specified expiration time. Timeout signatures are verified by TimeoutVerifier objects.

Author:
steveweis@gmail.com (Steve Weis)

Constructor Summary
TimeoutSigner(KeyczarReader reader)
          Initialize a new TimeoutSigner with a KeyczarReader.
TimeoutSigner(Signer signer)
          Initialize a new TimeoutSigner with a Signer object.
TimeoutSigner(java.lang.String fileLocation)
          Initialize a new TimeoutSigner with a key set location.
 
Method Summary
 byte[] timeoutSign(byte[] input, long expirationTime)
          Sign the given input and return a signature that is valid until the expiration time given as the number of milliseconds since "the epoch" of 1/1/1970 00:00:00 GMT
 void timeoutSign(java.nio.ByteBuffer input, long expirationTime, java.nio.ByteBuffer output)
          Signs the input and produces a signature that is valid until the expiration time given as the number of milliseconds since "the epoch" of 1/1/1970 00:00:00 GMT
 java.lang.String timeoutSign(java.lang.String input, long expirationTime)
          Sign the given input and return a signature that is valid until the expiration time given as the number of milliseconds since "the epoch" of 1/1/1970 00:00:00 GMT
 
Methods inherited from class org.keyczar.TimeoutVerifier
verify, verify, verify
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeoutSigner

public TimeoutSigner(KeyczarReader reader)
              throws KeyczarException
Initialize a new TimeoutSigner with a KeyczarReader. The corresponding key set must have a purpose KeyPurpose.SIGN_AND_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.

TimeoutSigner

public TimeoutSigner(java.lang.String fileLocation)
              throws KeyczarException
Initialize a new TimeoutSigner 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.SIGN_AND_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.

TimeoutSigner

public TimeoutSigner(Signer signer)
Initialize a new TimeoutSigner with a Signer object.

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

timeoutSign

public java.lang.String timeoutSign(java.lang.String input,
                                    long expirationTime)
                             throws KeyczarException
Sign the given input and return a signature that is valid until the expiration time given as the number of milliseconds since "the epoch" of 1/1/1970 00:00:00 GMT

Parameters:
input - The input to be signed
expirationTime - The expiration time in milliseconds since 1/1/1970 00:00:00 GMT
Returns:
The signature as a web safe Base64 string
Throws:
KeyczarException

timeoutSign

public byte[] timeoutSign(byte[] input,
                          long expirationTime)
                   throws KeyczarException
Sign the given input and return a signature that is valid until the expiration time given as the number of milliseconds since "the epoch" of 1/1/1970 00:00:00 GMT

Parameters:
input - The input to be signed
expirationTime - The expiration time in milliseconds since 1/1/1970 00:00:00 GMT
Returns:
The signature
Throws:
KeyczarException

timeoutSign

public void timeoutSign(java.nio.ByteBuffer input,
                        long expirationTime,
                        java.nio.ByteBuffer output)
                 throws KeyczarException
Signs the input and produces a signature that is valid until the expiration time given as the number of milliseconds since "the epoch" of 1/1/1970 00:00:00 GMT

Parameters:
input - The input to be signed
expirationTime - The expiration time in milliseconds since 1/1/1970 00:00:00 GMT
output - The destination of this signature
Throws:
KeyczarException