org.jcp.xml.dsig.internal.dom
Class DOMPGPData

java.lang.Object
  extended by org.jcp.xml.dsig.internal.dom.DOMStructure
      extended by org.jcp.xml.dsig.internal.dom.DOMPGPData
All Implemented Interfaces:
PGPData, XMLStructure

public final class DOMPGPData
extends DOMStructure
implements PGPData

DOM-based implementation of PGPData.

Author:
Sean Mullan

Field Summary
 
Fields inherited from interface javax.xml.crypto.dsig.keyinfo.PGPData
TYPE
 
Constructor Summary
DOMPGPData(byte[] keyId, byte[] keyPacket, java.util.List other)
          Creates a DOMPGPData containing the specified key id and optional key packet and list of external elements.
DOMPGPData(byte[] keyPacket, java.util.List other)
          Creates a DOMPGPData containing the specified key packet.
DOMPGPData(org.w3c.dom.Element pdElem)
          Creates a DOMPGPData from an element.
 
Method Summary
 java.util.List getExternalElements()
          Returns an unmodifiable list of XMLStructures representing elements from an external namespace.
 byte[] getKeyId()
          Returns the PGP public key identifier of this PGPData as defined in RFC 2440, section 11.2.
 byte[] getKeyPacket()
          Returns the PGP key material packet of this PGPData as defined in RFC 2440, section 5.5.
 void marshal(org.w3c.dom.Node parent, java.lang.String dsPrefix, DOMCryptoContext context)
           
 
Methods inherited from class org.jcp.xml.dsig.internal.dom.DOMStructure
isFeatureSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.xml.crypto.XMLStructure
isFeatureSupported
 

Constructor Detail

DOMPGPData

public DOMPGPData(byte[] keyPacket,
                  java.util.List other)
Creates a DOMPGPData containing the specified key packet. and optional list of external elements.

Parameters:
keyPacket - a PGP Key Material Packet as defined in section 5.5 of RFC 2440. The array is cloned to prevent subsequent modification.
other - a list of XMLStructures representing elements from an external namespace. The list is defensively copied to prevent subsequent modification. May be null or empty.
Throws:
java.lang.NullPointerException - if keyPacket is null
java.lang.IllegalArgumentException - if the key packet is not in the correct format
java.lang.ClassCastException - if other contains any entries that are not of type XMLStructure

DOMPGPData

public DOMPGPData(byte[] keyId,
                  byte[] keyPacket,
                  java.util.List other)
Creates a DOMPGPData containing the specified key id and optional key packet and list of external elements.

Parameters:
keyId - a PGP public key id as defined in section 11.2 of RFC 2440. The array is cloned to prevent subsequent modification.
keyPacket - a PGP Key Material Packet as defined in section 5.5 of RFC 2440 (may be null). The array is cloned to prevent subsequent modification.
other - a list of XMLStructures representing elements from an external namespace. The list is defensively copied to prevent subsequent modification. May be null or empty.
Throws:
java.lang.NullPointerException - if keyId is null
java.lang.IllegalArgumentException - if the key id or packet is not in the correct format
java.lang.ClassCastException - if other contains any entries that are not of type XMLStructure

DOMPGPData

public DOMPGPData(org.w3c.dom.Element pdElem)
           throws MarshalException
Creates a DOMPGPData from an element.

Parameters:
pdElem - a PGPData element
Throws:
MarshalException
Method Detail

getKeyId

public byte[] getKeyId()
Description copied from interface: PGPData
Returns the PGP public key identifier of this PGPData as defined in RFC 2440, section 11.2.

Specified by:
getKeyId in interface PGPData
Returns:
the PGP public key identifier (may be null if not specified). Each invocation of this method returns a new clone to protect against subsequent modification.

getKeyPacket

public byte[] getKeyPacket()
Description copied from interface: PGPData
Returns the PGP key material packet of this PGPData as defined in RFC 2440, section 5.5.

Specified by:
getKeyPacket in interface PGPData
Returns:
the PGP key material packet (may be null if not specified). Each invocation of this method returns a new clone to protect against subsequent modification.

getExternalElements

public java.util.List getExternalElements()
Description copied from interface: PGPData
Returns an unmodifiable list of XMLStructures representing elements from an external namespace.

Specified by:
getExternalElements in interface PGPData
Returns:
an unmodifiable list of XMLStructures (may be empty, but never null)

marshal

public void marshal(org.w3c.dom.Node parent,
                    java.lang.String dsPrefix,
                    DOMCryptoContext context)
             throws MarshalException
Specified by:
marshal in class DOMStructure
Throws:
MarshalException


Copyright © 2000-2014 The Apache Software Foundation. All Rights Reserved.