org.apache.jcp.xml.dsig.internal.dom
Class DOMKeyInfo

java.lang.Object
  extended by org.apache.jcp.xml.dsig.internal.dom.BaseStructure
      extended by org.apache.jcp.xml.dsig.internal.dom.DOMKeyInfo
All Implemented Interfaces:
KeyInfo, XMLStructure

public final class DOMKeyInfo
extends BaseStructure
implements KeyInfo

DOM-based implementation of KeyInfo.

Author:
Sean Mullan

Constructor Summary
DOMKeyInfo(Element kiElem, XMLCryptoContext context, Provider provider)
          Creates a DOMKeyInfo from XML.
DOMKeyInfo(List<? extends XMLStructure> content, String id)
          Creates a DOMKeyInfo.
 
Method Summary
 boolean equals(Object o)
           
 List<XMLStructure> getContent()
          Returns an unmodifiable list containing the key information.
static List<XMLStructure> getContent(KeyInfo ki)
          A utility function to suppress casting warnings.
 String getId()
          Return the optional Id attribute of this KeyInfo, which may be useful for referencing this KeyInfo from other XML structures.
 int hashCode()
           
 void marshal(XMLStructure parent, XMLCryptoContext context)
          Marshals the key info to XML.
static void marshal(XmlWriter xwriter, KeyInfo ki, String dsPrefix, XMLCryptoContext context)
           
 
Methods inherited from class org.apache.jcp.xml.dsig.internal.dom.BaseStructure
isFeatureSupported, textOfNode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.xml.crypto.XMLStructure
isFeatureSupported
 

Constructor Detail

DOMKeyInfo

public DOMKeyInfo(List<? extends XMLStructure> content,
                  String id)
Creates a DOMKeyInfo.

Parameters:
content - a list of one or more XMLStructures representing key information types. The list is defensively copied to protect against subsequent modification.
id - an ID attribute
Throws:
NullPointerException - if content is null
IllegalArgumentException - if content is empty
ClassCastException - if content contains any entries that are not of type XMLStructure

DOMKeyInfo

public DOMKeyInfo(Element kiElem,
                  XMLCryptoContext context,
                  Provider provider)
           throws MarshalException
Creates a DOMKeyInfo from XML.

Parameters:
kiElem - KeyInfo element
Throws:
MarshalException
Method Detail

getContent

public static List<XMLStructure> getContent(KeyInfo ki)
A utility function to suppress casting warnings.

Parameters:
ki -
Returns:

getId

public String getId()
Description copied from interface: KeyInfo
Return the optional Id attribute of this KeyInfo, which may be useful for referencing this KeyInfo from other XML structures.

Specified by:
getId in interface KeyInfo
Returns:
the Id attribute of this KeyInfo (may be null if not specified)

getContent

public List<XMLStructure> getContent()
Description copied from interface: KeyInfo
Returns an unmodifiable list containing the key information. Each entry of the list is an XMLStructure.

If there is a public subclass representing the type of XMLStructure, it is returned as an instance of that class (ex: an X509Data element would be returned as an instance of X509Data).

Specified by:
getContent in interface KeyInfo
Returns:
an unmodifiable list of one or more XMLStructures in this KeyInfo. Never returns null or an empty list.

marshal

public void marshal(XMLStructure parent,
                    XMLCryptoContext context)
             throws MarshalException
Description copied from interface: KeyInfo
Marshals the key info to XML.

Specified by:
marshal in interface KeyInfo
Parameters:
parent - a mechanism-specific structure containing the parent node that the marshalled key info will be appended to
context - the XMLCryptoContext containing additional context (may be null if not applicable)
Throws:
MarshalException - if the key info cannot be marshalled

marshal

public static void marshal(XmlWriter xwriter,
                           KeyInfo ki,
                           String dsPrefix,
                           XMLCryptoContext context)
                    throws MarshalException
Throws:
MarshalException

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2000–2013 The Apache Software Foundation. All rights reserved.