FileDocCategorySizeDatePackage
DOMValidateContext.javaAPI DocJava SE 6 API3485Tue Jun 10 00:27:06 BST 2008javax.xml.crypto.dsig.dom

DOMValidateContext

public class DOMValidateContext extends DOMCryptoContext implements XMLValidateContext
A DOM-specific {@link XMLValidateContext}. This class contains additional methods to specify the location in a DOM tree where an {@link XMLSignature} is to be unmarshalled and validated from.

Note that the behavior of an unmarshalled XMLSignature is undefined if the contents of the underlying DOM tree are modified by the caller after the XMLSignature is created.

Also, note that DOMValidateContext instances can contain information and state specific to the XML signature structure it is used with. The results are unpredictable if a DOMValidateContext is used with different signature structures (for example, you should not use the same DOMValidateContext instance to validate two different {@link XMLSignature} objects).

author
Sean Mullan
author
JSR 105 Expert Group
since
1.6
see
XMLSignatureFactory#unmarshalXMLSignature(XMLValidateContext)

Fields Summary
private Node
node
Constructors Summary
public DOMValidateContext(KeySelector ks, Node node)
Creates a DOMValidateContext containing the specified key selector and node.

param
ks a key selector for finding a validation key
param
node the node
throws
NullPointerException if ks or node is null

 
	if (ks == null) {
	    throw new NullPointerException("key selector is null");
	} 
	if (node == null) {
	    throw new NullPointerException("node is null");
	}
	setKeySelector(ks);
	this.node = node;
    
public DOMValidateContext(Key validatingKey, Node node)
Creates a DOMValidateContext containing the specified key and node. The validating key will be stored in a {@link KeySelector#singletonKeySelector singleton KeySelector} that is returned when the {@link #getKeySelector getKeySelector} method is called.

param
validatingKey the validating key
param
node the node
throws
NullPointerException if validatingKey or node is null

 
	if (validatingKey == null) {
	    throw new NullPointerException("validatingKey is null");
	}
	if (node == null) {
	    throw new NullPointerException("node is null");
	}
	setKeySelector(KeySelector.singletonKeySelector(validatingKey));
	this.node = node;
    
Methods Summary
public org.w3c.dom.NodegetNode()
Returns the node.

return
the node (never null)
see
#setNode(Node)

	return node;
    
public voidsetNode(org.w3c.dom.Node node)
Sets the node.

param
node the node
throws
NullPointerException if node is null
see
#getNode

	if (node == null) {
	    throw new NullPointerException();
	}
	this.node = node;