xades4j.production
Class XadesSigningProfile

java.lang.Object
  extended by xades4j.production.XadesSigningProfile
Direct Known Subclasses:
XadesBesSigningProfile, XadesEpesSigningProfile, XadesTSigningProfile

public abstract class XadesSigningProfile
extends Object

A profile for signature production. This class and its subclasses are the entry point for producing signatures. A profile is a configuration for the signature production process. This includes not only characteristics of the signer and the signature, such as the signing key/certificate and signature properties, but also components for the process itself, such as digest and time-stamp generation.

The purpose of this class is to configure a XadesSigner that will actually produce signatures with those characteristics.

Only a KeyingDataProvider has to externally be supplied. All the other components have default implementations that are used if no other actions are taken. However, all of them can be replaced through the corresponding methods, either by an instance or a class. When a class is used it may have dependencies on other components, which will be handled in order to create the XadesSigner. The types may also depend on external components, as long as that dependency is registered with on of the addBinding methods. To that end, the constructors and/or setters should use the Inject annotation from Guice.

Custom PropertyDataObjectGenerators can also be configured. The principles on their dependencies are the same.

The XAdES form is also part of the profile. Each form has additional requirements, hence being defined by a specific subclass. There are profiles up to XAdES-C. The extended formats are also supported (with a few limitations) but can only be added after verfication (XadesVerifier).

Repeated dependency bindings will not cause an immediate error. An exception will be thrown when an instance of XadesSigner is requested.

Author:
Luís
See Also:
XadesBesSigningProfile, XadesEpesSigningProfile, XadesTSigningProfile, XadesCSigningProfile, XadesProfileCore

Constructor Summary
protected XadesSigningProfile(Class<? extends KeyingDataProvider> keyingProviderClass)
           
protected XadesSigningProfile(KeyingDataProvider keyingProvider)
           
 
Method Summary
protected abstract  Class<? extends XadesSigner> getSignerClass()
           
 XadesSigner newSigner()
          Creates a new XadesSigner based on the current state of the profile.
 XadesSigningProfile withAlgorithmsProvider(AlgorithmsProvider algsProvider)
           
 XadesSigningProfile withAlgorithmsProvider(Class<? extends AlgorithmsProvider> algsProviderClass)
           
 XadesSigningProfile withBasicSignatureOptionsProvider(BasicSignatureOptionsProvider optionsProvider)
           
 XadesSigningProfile withBasicSignatureOptionsProvider(Class<? extends BasicSignatureOptionsProvider> optionsProvider)
           
<T> XadesSigningProfile
withBinding(Class<T> from, Class<? extends T> to)
          Adds a type dependency mapping to the profile.
<T> XadesSigningProfile
withBinding(Class<T> from, T to)
          Adds a instance dependency mapping to the profile.
 XadesSigningProfile withDataObjectPropertiesProvider(Class<? extends DataObjectPropertiesProvider> dataObjPropsProviderClass)
           
 XadesSigningProfile withDataObjectPropertiesProvider(DataObjectPropertiesProvider dataObjPropsProvider)
           
 XadesSigningProfile withDigestEngineProvider(Class<? extends MessageDigestEngineProvider> digestProviderClass)
           
 XadesSigningProfile withDigestEngineProvider(MessageDigestEngineProvider digestProvider)
           
<TProp extends QualifyingProperty>
XadesSigningProfile
withPropertyDataObjectGenerator(Class<TProp> propClass, Class<? extends PropertyDataObjectGenerator<TProp>> propDataGenClass)
           
<TProp extends QualifyingProperty>
XadesSigningProfile
withPropertyDataObjectGenerator(Class<TProp> propClass, PropertyDataObjectGenerator<TProp> propDataGen)
           
 XadesSigningProfile withSignaturePropertiesProvider(Class<? extends SignaturePropertiesProvider> signaturePropsProvClass)
           
 XadesSigningProfile withSignaturePropertiesProvider(SignaturePropertiesProvider signaturePropsProv)
           
 XadesSigningProfile withSignedPropertiesMarshaller(Class<? extends SignedPropertiesMarshaller> sPropsMarshallerClass)
           
 XadesSigningProfile withSignedPropertiesMarshaller(SignedPropertiesMarshaller sPropsMarshaller)
           
 XadesSigningProfile withTimeStampTokenProvider(Class<? extends TimeStampTokenProvider> tsTokenProviderClass)
           
 XadesSigningProfile withTimeStampTokenProvider(TimeStampTokenProvider tsTokenProvider)
           
 XadesSigningProfile withUnsignedPropertiesMarshaller(Class<? extends UnsignedPropertiesMarshaller> uPropsMarshallerClass)
           
 XadesSigningProfile withUnsignedPropertiesMarshaller(UnsignedPropertiesMarshaller uPropsMarshaller)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XadesSigningProfile

protected XadesSigningProfile(KeyingDataProvider keyingProvider)

XadesSigningProfile

protected XadesSigningProfile(Class<? extends KeyingDataProvider> keyingProviderClass)
Method Detail

newSigner

public final XadesSigner newSigner()
                            throws XadesProfileResolutionException
Creates a new XadesSigner based on the current state of the profile. If any changes are made after this call, the previously returned signer will not be afected. Other signers can be created, accumulating the profile changes.

Returns:
a XadesSigner accordingly to this profile
Throws:
XadesProfileResolutionException - if the dependencies of the signer (direct and indirect) cannot be resolved

getSignerClass

protected abstract Class<? extends XadesSigner> getSignerClass()

withBinding

public final <T> XadesSigningProfile withBinding(Class<T> from,
                                                 Class<? extends T> to)
Adds a type dependency mapping to the profile. This is tipically done from an interface to a type that implements that interface. When a dependency to from is found, the to class is used. The to class may in turn have its own dependencies.

The other withNNNNNN methods are convenient shortcuts for this one.

Parameters:
from - the dependency
to - the type that resolves the dependency
Returns:
this profile

withBinding

public final <T> XadesSigningProfile withBinding(Class<T> from,
                                                 T to)
Adds a instance dependency mapping to the profile. When a dependency to from is found, the to instance is used. The other withNNNNNN methods are convenient shortcuts for this one.

Parameters:
from - the dependency
to - the instance that resolves the dependency
Returns:
this profile

withAlgorithmsProvider

public XadesSigningProfile withAlgorithmsProvider(AlgorithmsProvider algsProvider)

withAlgorithmsProvider

public XadesSigningProfile withAlgorithmsProvider(Class<? extends AlgorithmsProvider> algsProviderClass)

withDigestEngineProvider

public XadesSigningProfile withDigestEngineProvider(MessageDigestEngineProvider digestProvider)

withDigestEngineProvider

public XadesSigningProfile withDigestEngineProvider(Class<? extends MessageDigestEngineProvider> digestProviderClass)

withBasicSignatureOptionsProvider

public XadesSigningProfile withBasicSignatureOptionsProvider(BasicSignatureOptionsProvider optionsProvider)

withBasicSignatureOptionsProvider

public XadesSigningProfile withBasicSignatureOptionsProvider(Class<? extends BasicSignatureOptionsProvider> optionsProvider)

withSignaturePropertiesProvider

public XadesSigningProfile withSignaturePropertiesProvider(SignaturePropertiesProvider signaturePropsProv)

withSignaturePropertiesProvider

public XadesSigningProfile withSignaturePropertiesProvider(Class<? extends SignaturePropertiesProvider> signaturePropsProvClass)

withDataObjectPropertiesProvider

public XadesSigningProfile withDataObjectPropertiesProvider(DataObjectPropertiesProvider dataObjPropsProvider)

withDataObjectPropertiesProvider

public XadesSigningProfile withDataObjectPropertiesProvider(Class<? extends DataObjectPropertiesProvider> dataObjPropsProviderClass)

withTimeStampTokenProvider

public XadesSigningProfile withTimeStampTokenProvider(TimeStampTokenProvider tsTokenProvider)

withTimeStampTokenProvider

public XadesSigningProfile withTimeStampTokenProvider(Class<? extends TimeStampTokenProvider> tsTokenProviderClass)

withSignedPropertiesMarshaller

public XadesSigningProfile withSignedPropertiesMarshaller(SignedPropertiesMarshaller sPropsMarshaller)

withSignedPropertiesMarshaller

public XadesSigningProfile withSignedPropertiesMarshaller(Class<? extends SignedPropertiesMarshaller> sPropsMarshallerClass)

withUnsignedPropertiesMarshaller

public XadesSigningProfile withUnsignedPropertiesMarshaller(UnsignedPropertiesMarshaller uPropsMarshaller)

withUnsignedPropertiesMarshaller

public XadesSigningProfile withUnsignedPropertiesMarshaller(Class<? extends UnsignedPropertiesMarshaller> uPropsMarshallerClass)

withPropertyDataObjectGenerator

public <TProp extends QualifyingProperty> XadesSigningProfile withPropertyDataObjectGenerator(Class<TProp> propClass,
                                                                                              PropertyDataObjectGenerator<TProp> propDataGen)

withPropertyDataObjectGenerator

public <TProp extends QualifyingProperty> XadesSigningProfile withPropertyDataObjectGenerator(Class<TProp> propClass,
                                                                                              Class<? extends PropertyDataObjectGenerator<TProp>> propDataGenClass)


Copyright © 2012. All Rights Reserved.