public class Signer
extends java.lang.Object
Signer(URI)Signer(Document, URI, Position)Signer(InputStream, URI, Position)| Modifier and Type | Field and Description |
|---|---|
protected java.util.List |
addedNSDecls_
Contains all namespace nodes which have been added to
signatureDocOM_. |
protected SignerSignature |
signature_
Represents the XML signature itself.
|
protected org.w3c.dom.Document |
signatureDocOM_
Holds the object model (OM) representing the logical structure of the XML signature document.
|
protected static boolean |
SIGNING_
Indicates the signature creation use case.
|
protected URIResolverParameters |
uriResolverParameters_
Structure encapsulating some parameters for resolving URIs within the IXSIL core.
|
protected boolean |
useCase_
Indicates if this object is used for signing or verifying.
|
protected boolean |
validated_
Shows if the signature document could have been parsed with validation on, or has been parsed with
validation off.
|
protected static boolean |
VERIFYING_
Indicates the signature verification use case.
|
| Constructor and Description |
|---|
Signer(org.w3c.dom.Document signatureDocOM,
URI signatureDocBaseURI,
Position signaturePosition)
Used to insert the XML signature which is to be created into an existing XML document at an arbitrary
position.
|
Signer(org.w3c.dom.Element signatureParentElement,
URI signatureDocBaseURI,
int signatureChildIndex)
Used to insert the XML signature which is to be created into an existing XML document at an arbitrary
position.
|
Signer(java.io.InputStream signatureDocStream,
URI signatureDocBaseURI,
Position signaturePosition)
Used to insert the XML signature which is to be created into an existing XML document at an arbitrary
position.
|
Signer(java.io.InputStream signatureDocStream,
URI signatureDocBaseURI,
Position signaturePosition,
java.lang.String noNamespaceSchemaLocation,
java.lang.String schemaLocations)
Used to insert the XML signature which is to be created into an existing XML document at an arbitrary
position.
|
Signer(URI signatureDocBaseURI)
Used to create a completely new XML document with the XML signature which is to be created as its root
element.
|
| Modifier and Type | Method and Description |
|---|---|
SignerManifest |
createManifest()
Used by the application to create a new, empty manifest.
|
SignatureProperties |
createSignatureProperties()
Used by the application to create a new, empty signature property container.
|
SignerSignature |
getSignature()
Gets an interface to the signature object for the signing use case.
|
protected void |
initResolvers()
Initializes the default implementations for the internal (
XPointerReferenceResolver) and
the external (ExternalReferenceResolverImpl) reference resolver. |
protected void |
insertSignature(org.w3c.dom.Element signatureParentElement,
int signatureChildIndex)
Inserts an empty DOM element for the XML signature as child of the given parent element at the
specified position.
|
protected void |
insertSignature(Position signaturePosition)
Inserts an empty DOM element for the XML signature into the signature DOM document at the specified
position.
|
void |
setExternalRefResolver(ExternalReferenceResolverInterface externalRefResolver)
Sets the object which is responsible for resolving external URIs, i.
|
void |
setInternalRefResolver(InternalReferenceResolverInterface internalRefResolver)
Sets the object which is responsible for resolving internal URIs, i.
|
org.w3c.dom.Document |
toDocument()
Gets the object model representation for the XML document containing the XML signature.
|
void |
withdrawDistributedNSDeclarations()
Removes namespace declarations which have eventually been inserted into the XML document bearing the
XML signature by IXSIL during signature creation or signature validation respectively.
|
protected SignerSignature signature_
protected static final boolean SIGNING_
protected static final boolean VERIFYING_
protected boolean validated_
protected org.w3c.dom.Document signatureDocOM_
protected URIResolverParameters uriResolverParameters_
protected boolean useCase_
protected java.util.List addedNSDecls_
signatureDocOM_. This member variable is
part of "TreeModelWorkaround".public Signer(URI signatureDocBaseURI) throws SignatureHandlerException
signatureDocBaseURI - Holds the base URI for the signature document used to resolve relative URIs
in several cases. Must either be null or an absolute URI.SignatureHandlerException - if creating the new XML document fails.public Signer(org.w3c.dom.Document signatureDocOM,
URI signatureDocBaseURI,
Position signaturePosition)
throws SignatureHandlerException
signatureDocOM - The object model of the XML document into which the XML signature is inserted.
Must not be null.signatureDocBaseURI - Holds the base URI for the signature document used to resolve relative URIs
in several cases. Must either be null or an absolute URI.signaturePosition - The position where to insert the XML signature into the existing XML document.
Must not be null.SignatureHandlerException - if parsing the existing XML document fails, or if inserting the
structures for the XML signature into the XML document fails.public Signer(org.w3c.dom.Element signatureParentElement,
URI signatureDocBaseURI,
int signatureChildIndex)
throws SignatureHandlerException
signatureParentElement - The parent element into which the XML signature is inserted as a child.
Must not be null.signatureDocBaseURI - Holds the base URI for the signature document used to resolve relative URIs
in several cases. Must either be null or an absolute URI.signatureChildIndex - The index where to insert the XML signature element as a child element
of the element given as signatureParentElement. For example,
if this index is 1, the signature element is inserted as the second child
of the signatureParentElement element. If this index is
-1, the signature will be appended as the last child of the
signatureParentElement element.SignatureHandlerException - if parsing the existing XML document fails, or if inserting the
structures for the XML signature into the XML document fails.public Signer(java.io.InputStream signatureDocStream,
URI signatureDocBaseURI,
Position signaturePosition)
throws SignatureHandlerException
signatureDocStream - The input stream of the XML document into which the XML signature is
inserted. Must not be null.signatureDocBaseURI - Holds the base URI for the signature document used to resolve relative URIs
in several cases. Must either be null or an absolute URI.signaturePosition - The position where to insert the XML signature into the existing XML document.
Must not be null.SignatureHandlerException - if parsing the existing XML document fails, or if inserting the
structures for the XML signature into the XML document fails.public Signer(java.io.InputStream signatureDocStream,
URI signatureDocBaseURI,
Position signaturePosition,
java.lang.String noNamespaceSchemaLocation,
java.lang.String schemaLocations)
throws SignatureHandlerException
signatureDocStream - The input stream of the XML document into which the XML signature is
inserted. Must not be null.signatureDocBaseURI - Holds the base URI for the signature document used to resolve relative URIs
in several cases. Must either be null or an absolute URI.signaturePosition - The position where to insert the XML signature into the existing XML document.
Must not be null.noNamespaceSchemaLocation - This URI string can be used to provide a Schema for the no-namespace
in cases where the DOM document should be created by a validating
parser (see also parameter validate). May be null
. Valid example: "http://repository.foo.org/mySchema.xsd".schemaLocations - This parameter can be used to provide schemas for various namespaces in cases
where the DOM document should be created by a validating parser (see also
parameter validate). Must either be null or conform
to the following rules:
additionalSchemas ::= additionalSchema (space additionalSchema)*
additionalSchema ::= schemaNamespaceURI space schemaLocationURI
For example, "http://foo.org/mySchema http://repository.foo.org/mySchema.xsd".SignatureHandlerException - if parsing the existing XML document fails, or if inserting the
structures for the XML signature into the XML document fails.public SignerManifest createManifest()
public SignatureProperties createSignatureProperties()
public SignerSignature getSignature()
public org.w3c.dom.Document toDocument()
withdrawDistributedNSDeclarations()).protected void insertSignature(org.w3c.dom.Element signatureParentElement,
int signatureChildIndex)
throws SignatureHandlerException
signatureParentElement - The parent element into which the XML signature is inserted as a child.
Must not be null.signatureChildIndex - The index where to insert the XML signature element as a child element
of the element given as signatureParentElement. For example,
if this index is 1, the signature element is inserted as the second child
of the signatureParentElement element. If this index is
-1, the signature will be appended as the last child of the
signatureParentElement element.SignatureHandlerException - if inserting the empty Signature DOM element fails.protected void insertSignature(Position signaturePosition) throws SignatureHandlerException
signaturePosition - The position where to insert the XML signature DOM element.SignatureHandlerException - if inserting the empty Signature DOM element fails.public void setInternalRefResolver(InternalReferenceResolverInterface internalRefResolver)
InternalReferenceResolverImpl will be used.internalRefResolver - The object which is responsible for resolving internal URIs. Must not be
null.public void setExternalRefResolver(ExternalReferenceResolverInterface externalRefResolver)
ExternalReferenceResolverImpl) will be used.externalRefResolver - The object which is responsible for resolving external URIs. Must not be
null.protected void initResolvers()
XPointerReferenceResolver) and
the external (ExternalReferenceResolverImpl) reference resolver.public void withdrawDistributedNSDeclarations()