Handling signature properties

Within the <Signature>, you can include statements about the XML signature itself. Collect the statements as <SignedProperty> child elements within a parent <SignatureProperties> element.

Creating a signature container

Create a signature property container.

SignerSignatureProperties properties = signer.createSignatureProperties();

Creating signature properties

Create and add the first signature property.

SignatureProperty firstProp = properties.createSignatureProperty("Content of first (unsigned) signature property");
firstProp.setTarget("#001");
properties.addSignatureProperty(firstProp);

Create and add a second signature property.

SignatureProperty secondProp = properties.createSignatureProperty("Content of second (signed) signature property");
secondProp.setTarget("#001");
secondProp.setId("SignedProperty");
properties.addSignatureProperty(secondProp);

Create an object container for the signature properties and incorporate it into the XML signature

Element propertiesDOMElem = properties.toElement();
iaik.ixsil.core.Object propertiesObject = signature.createObject(propertiesDOMElem);
signature.addObject(propertiesObject);

Creating a manifest

Create an empty Manifest.

SignerManifest manifest = signer.createManifest();
manifest.setId("Manifest");

Create a reference.

SignerReference manifestRef = manifest.createReference();

Set reference URI.

manifestRef.setURI(new URI(<reference>));

Create a digest algorithm.

DigestAlgorithmImplSHA1 manifestDigestAlg = new DigestAlgorithmImplSHA1();

Set digest algorithm URI.

manifestDigestAlg.setURI(new URI("http://www.w3.org/2000/09/xmldsig#sha1"));

Set digest algorithm.

manifestRef.setDigestAlgorithm(manifestDigestAlg);

Add a reference to the manifest.

manifest.addReference(manifestRef);

Create an object container for the manifest and incorporate it into the signature.

Element manifestDOMElem = manifest.toElement();
iaik.ixsil.core.Object manifestObject = signature.createObject(manifestDOMElem);