xades4j.providers.impl
Class DefaultTimeStampTokenProvider

java.lang.Object
  extended by xades4j.providers.impl.DefaultTimeStampTokenProvider
All Implemented Interfaces:
TimeStampTokenProvider

public class DefaultTimeStampTokenProvider
extends Object
implements TimeStampTokenProvider

Default implementation of TimeStampTokenProvider. It uses the SUN proprietary API in the sun.security.timestamp and sun.security.pkcs packages. By default it used simple HTTP to get the time-stamp token from the TSA at http://tss.accv.es:8318/tsa. Both the Timestamper and the TSA URL can be overriden.

The TSA certificate is requested. If the token is granted with mods, a check is made to ensure that the mod wasn't not providing the certificate. If so, an exception is thrown.

Author:
Luís

Nested Class Summary
 
Nested classes/interfaces inherited from interface xades4j.providers.TimeStampTokenProvider
TimeStampTokenProvider.TimeStampTokenRes
 
Constructor Summary
DefaultTimeStampTokenProvider(MessageDigestEngineProvider messageDigestProvider)
           
 
Method Summary
protected  sun.security.timestamp.Timestamper getTimestamper()
          Gets the Timestamper to be used.
 TimeStampTokenProvider.TimeStampTokenRes getTimeStampToken(byte[] tsDigestInput, String digestAlgUri)
          Gets a time-stamp token.
protected  String getTSAUrl()
          Gets the TSA URL when the default HttpTimestamper is used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTimeStampTokenProvider

@Inject
public DefaultTimeStampTokenProvider(MessageDigestEngineProvider messageDigestProvider)
Method Detail

getTimeStampToken

public final TimeStampTokenProvider.TimeStampTokenRes getTimeStampToken(byte[] tsDigestInput,
                                                                        String digestAlgUri)
                                                                 throws TimeStampTokenGenerationException
Description copied from interface: TimeStampTokenProvider
Gets a time-stamp token.

Specified by:
getTimeStampToken in interface TimeStampTokenProvider
Parameters:
tsDigestInput - the input for the digest to be sent to the TSA
digestAlgUri - the digest algorithm that should be used to calculate the digest
Returns:
the time-stamp token data
Throws:
TimeStampTokenGenerationException - if there's an error getting the time-stamp

getTimestamper

protected sun.security.timestamp.Timestamper getTimestamper()
Gets the Timestamper to be used. Override to change this behaviour. By default, this method invokes getTSAUrl to create an HttpTimestamper.

Returns:
the timestamper

getTSAUrl

protected String getTSAUrl()
Gets the TSA URL when the default HttpTimestamper is used. Override to change the TSA in use.

Returns:
the url (default is http://tss.accv.es:8318/tsa


Copyright © 2012. All Rights Reserved.