public final class

SignedDataObjects

extends Object
java.lang.Object
   ↳ xades4j.production.SignedDataObjects

Class Overview

Represents a set of data objects to be signed. Besides the data objects themselves, this class can be used to specify:

  • Properties that apply to ALL the signed data objects
  • A base URI for the data object references
  • ResourceResolvers to be used when processing the current set of data objects, in addition to the globally registered resolvers
A set of objects to be signed. Properties that apply to ALL the signed data objects can be specified via this class. This class checks for duplicate data object descriptions (not allowed).

Summary

Public Constructors
SignedDataObjects()
Creates an empty container.
SignedDataObjects(Iterable<DataObjectDesc> dataObjs)
Creates a container with the given data objects.
SignedDataObjects(DataObjectDesc... dataObjs)
Creates a container with the given data objects.
Public Methods
SignedDataObjects withBaseUri(String baseUri)
Sets the base URI for all the relative references.
SignedDataObjects withCommitmentType(AllDataObjsCommitmentTypeProperty commitment)
Adds a CommitmentType signed property shared among all data objects.
SignedDataObjects withDataObjectsTimeStamp()
Adds a AllDataObjectsTimeStamp signed property applied to all data objects.
SignedDataObjects withOtherDataObjectProperty(OtherUnsignedDataObjectProperty otherUnsignedDataObjProp)
Adds a custom global unsigned data object property.
SignedDataObjects withOtherDataObjectProperty(OtherSignedDataObjectProperty otherSignedDataObjProp)
Adds a custom global signed data object property.
SignedDataObjects withResourceResolver(ResourceResolver resolver)
Registers a ResourceResolver to be used when signing the current set of data objects.
SignedDataObjects withSignedDataObject(DataObjectDesc object)
Adds a data object to be signed.
SignedDataObjects withSignedDataObjects(Iterable<DataObjectDesc> objsInfo)
Adds a set of data objects to be signed.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SignedDataObjects ()

Creates an empty container.

public SignedDataObjects (Iterable<DataObjectDesc> dataObjs)

Creates a container with the given data objects.

Parameters
dataObjs the signed data objects
Throws
NullPointerException if dataObjs or any of the objects is null

public SignedDataObjects (DataObjectDesc... dataObjs)

Creates a container with the given data objects.

Parameters
dataObjs the signed data objects
Throws
NullPointerException if dataObjs or any of the objects is null

Public Methods

public SignedDataObjects withBaseUri (String baseUri)

Sets the base URI for all the relative references. Fragment references (starting with '#') are not afected.

Parameters
baseUri the references' base uri
Returns
  • the current instance

public SignedDataObjects withCommitmentType (AllDataObjsCommitmentTypeProperty commitment)

Adds a CommitmentType signed property shared among all data objects. The resulting property in the XAdES signature will contain the AllSignedDataObjects element. This method can be invoked multiple times with different properties since the signer may express multiple commitments towards the data objects.

Parameters
commitment the CommitmentType property
Returns
  • the current instance
Throws
PropertyTargetException if the given property (instance) is already present
NullPointerException if the given property is null

public SignedDataObjects withDataObjectsTimeStamp ()

Adds a AllDataObjectsTimeStamp signed property applied to all data objects. This method can be invoked multiple times since multiple times-stamps can be present.

Returns
  • the current instance

public SignedDataObjects withOtherDataObjectProperty (OtherUnsignedDataObjectProperty otherUnsignedDataObjProp)

Adds a custom global unsigned data object property. The purpose of this method is extensibility.

Each custom property needs a corresponding PropertyDataObjectGenerator which can be supplied through XadesSigningProfile.

Parameters
otherUnsignedDataObjProp the custom property
Returns
  • the current instance
Throws
NullPointerException if otherUnsignedDataObjProp is null
PropertyTargetException if the property is already present
IllegalArgumentException if the property if not properly annotated

public SignedDataObjects withOtherDataObjectProperty (OtherSignedDataObjectProperty otherSignedDataObjProp)

Adds a custom global signed data object property. The purpose of this method is extensibility.

Each custom property needs a corresponding PropertyDataObjectGenerator which can be supplied through XadesSigningProfile.

Parameters
otherSignedDataObjProp the custom property
Returns
  • the current instance
Throws
NullPointerException if otherSignedDataObjProp is null
PropertyTargetException if the property is already present
IllegalArgumentException if the property if not properly annotated

public SignedDataObjects withResourceResolver (ResourceResolver resolver)

Registers a ResourceResolver to be used when signing the current set of data objects. The resolvers are considered in the same order they are added and have priority over the globally registered resolvers.

Parameters
resolver the resolver
Returns
  • the current instance
Throws
NullPointerException if resolver is null

public SignedDataObjects withSignedDataObject (DataObjectDesc object)

Adds a data object to be signed. Each data object description will result in a ds:Reference element in the final XAdES signature.

Parameters
object the data object
Returns
  • the current instance
Throws
NullPointerException if object is null
IllegalStateException if the data object description is already present

public SignedDataObjects withSignedDataObjects (Iterable<DataObjectDesc> objsInfo)

Adds a set of data objects to be signed. Each data object description will result in a ds:Reference element in the final XAdES signature.

Parameters
objsInfo the data objects
Returns
  • the current instance
Throws
NullPointerException if objsInfo or any of the objects is null
IllegalStateException if any of the data object descriptions is already present