DigiStamp.com

com.digistamp.tsp
Class TSAConfig

java.lang.Object
  extended by com.digistamp.tsp.TSAConfig

public class TSAConfig
extends java.lang.Object

Configures the user's preferences for using the Internet to communicate with DigiStamp time stamp servers. The configuration includes, for example, which time servers to use and rules for fail-over to alternative servers.

This configuration data-object can be specified uniquely for each call to the DigiStamp server. Or, you can set a "global" configuration for all calls to the server (see: com.digistamp.tsp.DgsComm#setGlobalConfig(com.digistamp.tsp.TSAConfig) ).

The configuration data can be read from a file (see: readFile(String)). An example of the file's contents:

acctId = 1612
passwordClear = yourPassword
sslFlag = false
listOfServers.0 = tsatest1
listOfServers.1 = tsatest2
roundRobin = true
retryNum = 3
traceFlag = false
rootCertificatePath = DigiStamp.cer

Any particular field value that is not specified will have the default value as described in the field description below.


Field Summary
static java.lang.String defaultConfigFileName
          The default name of the file that holds the configuration data.
static int listSize
          Maximim size of setListOfServers(String[]).
 java.util.Properties storageProperties
           
 
Constructor Summary
TSAConfig()
          Constructor
TSAConfig(java.io.FileInputStream in)
          Constructor
TSAConfig(java.util.Properties props)
          Constructor
TSAConfig(TSAConfig orig)
          Copy constructor
 
Method Summary
 java.lang.String getAcctId()
          Account number of the user at DigiStamp.
 int getHoldOutMinutes()
          If a server did fail how long should we wait before allowing it to be tried again.
 java.lang.String[] getListOfServers()
          The list of DigiStamp servers that will be used to create time stamps.
 byte[] getPassword()
          The SHA-1 hash of the password is returned;
 int getRetryNum()
          How many times should the time-stamp request be attempted.
 java.lang.String getRootCertificatePath()
          Where is the DigiStamp root certificate stored.
 int getTimeOut()
          How long to wait before you "timeout" waiting for a response for the DigiStamp server.
 boolean isRoundRobin()
          Use the time-stamp servers in the list in a round-robin fashion.
 boolean isSslFlag()
          Flag to indicate if SSL communication is to be used.
 void load(java.io.InputStream fis)
           
static TSAConfig readFile(java.lang.String fileName)
          Load the value of the configuration from a file.
 void setAcctId(java.lang.String acctId)
          Account number of the user at DigiStamp.
 void setHoldOutMinutes(int holdOutMinutes)
          If a server did fail how long should we wait before allowing it to be tried again.
 void setListOfServers(java.lang.String[] listOfServers)
          The list of DigiStamp servers that will be used to create time stamps.
 void setPasswordClear(java.lang.String password)
          Password of the user.
 void setRetryNum(int retryNum)
          How many times should the time-stamp request be attempted.
 void setRootCertificatePath(java.lang.String rootCertificatePath)
          Where is the DigiStamp root certificate stored.
 void setRoundRobin(boolean roundRobin)
          Use the time-stamp servers in the list in a round-robin fashion.
 void setSslFlag(boolean sslFlag)
          Flag to indicate if SSL communication is to be used.
 void setTimeOut(int timeOut)
          How long to wait before you "timeout" waiting for a response for the DigiStamp server.
 void store(java.io.OutputStream out, java.lang.String comments)
          Write the current set of properties.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultConfigFileName

public static final java.lang.String defaultConfigFileName
The default name of the file that holds the configuration data. Used in method readFile(String)when the user provides no other file name.

See Also:
Constant Field Values

listSize

public static final int listSize
Maximim size of setListOfServers(String[]). The value is 16 and cannot be changed.

See Also:
Constant Field Values

storageProperties

public java.util.Properties storageProperties
Constructor Detail

TSAConfig

public TSAConfig()
Constructor


TSAConfig

public TSAConfig(java.io.FileInputStream in)
          throws java.io.IOException
Constructor

Throws:
java.io.IOException

TSAConfig

public TSAConfig(java.util.Properties props)
Constructor


TSAConfig

public TSAConfig(TSAConfig orig)
Copy constructor

Method Detail

getAcctId

public java.lang.String getAcctId()
Account number of the user at DigiStamp.

Returns:
the acctId

getHoldOutMinutes

public int getHoldOutMinutes()
If a server did fail how long should we wait before allowing it to be tried again. If all servers in the list had failed and are still in the held-out status then the oldest item in the list will be used. The value is specified in minutes. The default is 30 minutes.

Returns:
the holdOutMinutes

getListOfServers

public java.lang.String[] getListOfServers()
The list of DigiStamp servers that will be used to create time stamps. See setListOfServers(String[]) for details.

Returns:
the listOfServers

getPassword

public byte[] getPassword()
The SHA-1 hash of the password is returned;

Returns:
the password

getRetryNum

public int getRetryNum()
How many times should the time-stamp request be attempted. See setRetryNum(int)

Returns:
the retryNum

getRootCertificatePath

public java.lang.String getRootCertificatePath()
Where is the DigiStamp root certificate stored. While testing your code you would use the DigiStamp TEST CA certificate. See:

https://support.digistamp.com/pubCerts.htm


getTimeOut

public int getTimeOut()
How long to wait before you "timeout" waiting for a response for the DigiStamp server. See setTimeOut(int)


isRoundRobin

public boolean isRoundRobin()
Use the time-stamp servers in the list in a round-robin fashion. See setRoundRobin(boolean) for details.


isSslFlag

public boolean isSslFlag()
Flag to indicate if SSL communication is to be used. See for details.


load

public void load(java.io.InputStream fis)
          throws java.io.FileNotFoundException,
                 java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

readFile

public static TSAConfig readFile(java.lang.String fileName)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException
Load the value of the configuration from a file.

If you call this method with the value of null then the processing will attempt to use the file specified by DgsConfig.defaultConfigFileName in the current working directory.

Parameters:
fileName - String - file name. fully qualified or processing assumes current working directory
Returns:
DgsConfig
Throws:
java.io.FileNotFoundException
java.io.IOException

setAcctId

public void setAcctId(java.lang.String acctId)
Account number of the user at DigiStamp.


setHoldOutMinutes

public void setHoldOutMinutes(int holdOutMinutes)
If a server did fail how long should we wait before allowing it to be tried again. If all servers in the list had failed and are still in the held-out status then the oldest item in the list will be used. The value is specified in minutes. The default is 30 minutes.


setListOfServers

public void setListOfServers(java.lang.String[] listOfServers)
The list of DigiStamp servers that will be used to create time stamps. This toolkit will work only with DigiStamp servers and therefore the list of name is just the first portion of the URL. For example a list of [TSA1,TSA2] will use the DigiStamp servers at URL http://TSA1.digistamp.com/tsa and http://TSA2.digistamp.com/tsa the listOfServers to set


setPasswordClear

public void setPasswordClear(java.lang.String password)
Password of the user. The password is communicated in an HMAC style. The toolkit expects the SHA-1 hash of the password.

Your password must be also be know/shared with the DigiStamp server. Your password at DigiStamp is established during account setup or by using the User Support section of our web site.

Parameters:
password - the password to set

setRetryNum

public void setRetryNum(int retryNum)
How many times should the time-stamp request be attempted. This enables the toolkit to try the time stamp request multiple times until a time stamp is retrieved. If a list of multiple servers has been specified in setListOfServers(String[]) then the next server in the list will be accessed for the time-stamp request. A value of 0 is assumed to be the value 1. The default is 3. Maximum is 6.

Parameters:
retryNum - the retryNum to set

setRootCertificatePath

public void setRootCertificatePath(java.lang.String rootCertificatePath)
Where is the DigiStamp root certificate stored. While testing your code you would use the DigiStamp TEST CA certificate. See:

https://support.digistamp.com/pubCerts.htm

Parameters:
rootCertificatePath - the file that contains the DigiStamp root certificate

setRoundRobin

public void setRoundRobin(boolean roundRobin)
Use the time-stamp servers in the list in a round-robin fashion. Default is true. Setting this to true has no affect if there are not multiple server names provided in the setListOfServers(String[]) . This feature would only be valuable to use if you are using the toolkit in a multi-thread environment. In this situation, "round robin" would allow you to execute many requests concurrently using a variety of DigiStamp servers. Each time stamp request would still take the same amount of time to transmit, but you would be engaging many servers. This "high concurrency" option can be used if DigiStamp is aware of your special processing requirements and has approved this high throughput. To enable this feature the configuration must be set using the method com.digistamp.tsp.DgsComm#setGlobalConfig(com.digistamp.tsp.TSAConfig) .

Parameters:
roundRobin - the roundRobin to set

setSslFlag

public void setSslFlag(boolean sslFlag)
Flag to indicate if SSL communication is to be used. The default is false. If you verify the returned time stamp using a trusted root certificate that you retrieve and installed manually on the client machine then the use of SSL does not seem necessary. A successful verfication with a trusted certificate is proof-of-origin from the time stamp server.

Parameters:
sslFlag - the sslFlag to set

setTimeOut

public void setTimeOut(int timeOut)
How long to wait before you "timeout" waiting for a response for the DigiStamp server. If a "timeout" occurs the the setRetryNum(int) behavior is used. Specifying 0 seconds causes Internet communications to time-out based on your operating system configuration. Using this configuration field allows your timeout to occur in a shorter duration that your operating system, but not longer. The minimum setting is 5 seconds. The default is set to 20 seconds.

Parameters:
timeOut - the timeOut to set

store

public void store(java.io.OutputStream out,
                  java.lang.String comments)
           throws java.io.IOException
Write the current set of properties.

Parameters:
out -
comments -
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Copyright 2000-2010 DigiStamp, Inc.