Class DOMPGPData

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

public final class DOMPGPData extends DOMStructure implements PGPData
DOM-based implementation of PGPData.
  • Field Details

    • keyId

      private final byte[] keyId
    • keyPacket

      private final byte[] keyPacket
    • externalElements

      private final List<XMLStructure> externalElements
  • Constructor Details

    • DOMPGPData

      public DOMPGPData(byte[] keyPacket, List<? extends XMLStructure> 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:
      NullPointerException - if keyPacket is null
      IllegalArgumentException - if the key packet is not in the correct format
      ClassCastException - if other contains any entries that are not of type XMLStructure
    • DOMPGPData

      public DOMPGPData(byte[] keyId, byte[] keyPacket, List<? extends XMLStructure> 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:
      NullPointerException - if keyId is null
      IllegalArgumentException - if the key id or packet is not in the correct format
      ClassCastException - if other contains any entries that are not of type XMLStructure
    • DOMPGPData

      public DOMPGPData(Element pdElem) throws MarshalException
      Creates a DOMPGPData from an element.
      Parameters:
      pdElem - a PGPData element
      Throws:
      MarshalException
  • Method Details

    • getKeyId

      public byte[] getKeyId()
      Specified by:
      getKeyId in interface PGPData
    • getKeyPacket

      public byte[] getKeyPacket()
      Specified by:
      getKeyPacket in interface PGPData
    • getExternalElements

      public List<XMLStructure> getExternalElements()
      Specified by:
      getExternalElements in interface PGPData
    • marshal

      public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException
      Specified by:
      marshal in class DOMStructure
      Throws:
      MarshalException
    • checkKeyPacket

      private void checkKeyPacket(byte[] keyPacket)
      We assume packets use the new format packet syntax, as specified in section 4 of RFC 2440. This method only checks if the packet contains a valid tag. The contents of the packet should be checked by the application.