Class DOMPGPData

  • All Implemented Interfaces:
    javax.xml.crypto.dsig.keyinfo.PGPData, javax.xml.crypto.XMLStructure

    public final class DOMPGPData
    extends DOMStructure
    implements javax.xml.crypto.dsig.keyinfo.PGPData
    DOM-based implementation of PGPData.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<javax.xml.crypto.XMLStructure> externalElements  
      private byte[] keyId  
      private byte[] keyPacket  
      • Fields inherited from interface javax.xml.crypto.dsig.keyinfo.PGPData

        TYPE
    • Constructor Summary

      Constructors 
      Constructor Description
      DOMPGPData​(byte[] keyId, byte[] keyPacket, java.util.List<? extends javax.xml.crypto.XMLStructure> other)
      Creates a DOMPGPData containing the specified key id and optional key packet and list of external elements.
      DOMPGPData​(byte[] keyPacket, java.util.List<? extends javax.xml.crypto.XMLStructure> other)
      Creates a DOMPGPData containing the specified key packet.
      DOMPGPData​(org.w3c.dom.Element pdElem)
      Creates a DOMPGPData from an element.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void checkKeyPacket​(byte[] keyPacket)
      We assume packets use the new format packet syntax, as specified in section 4 of RFC 2440.
      java.util.List<javax.xml.crypto.XMLStructure> getExternalElements()  
      byte[] getKeyId()  
      byte[] getKeyPacket()  
      void marshal​(org.w3c.dom.Node parent, java.lang.String dsPrefix, javax.xml.crypto.dom.DOMCryptoContext context)  
      • 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
    • Field Detail

      • keyId

        private final byte[] keyId
      • keyPacket

        private final byte[] keyPacket
      • externalElements

        private final java.util.List<javax.xml.crypto.XMLStructure> externalElements
    • Constructor Detail

      • DOMPGPData

        public DOMPGPData​(byte[] keyPacket,
                          java.util.List<? extends javax.xml.crypto.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:
        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<? extends javax.xml.crypto.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:
        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 javax.xml.crypto.MarshalException
        Creates a DOMPGPData from an element.
        Parameters:
        pdElem - a PGPData element
        Throws:
        javax.xml.crypto.MarshalException
    • Method Detail

      • getKeyId

        public byte[] getKeyId()
        Specified by:
        getKeyId in interface javax.xml.crypto.dsig.keyinfo.PGPData
      • getKeyPacket

        public byte[] getKeyPacket()
        Specified by:
        getKeyPacket in interface javax.xml.crypto.dsig.keyinfo.PGPData
      • getExternalElements

        public java.util.List<javax.xml.crypto.XMLStructure> getExternalElements()
        Specified by:
        getExternalElements in interface javax.xml.crypto.dsig.keyinfo.PGPData
      • marshal

        public void marshal​(org.w3c.dom.Node parent,
                            java.lang.String dsPrefix,
                            javax.xml.crypto.dom.DOMCryptoContext context)
                     throws javax.xml.crypto.MarshalException
        Specified by:
        marshal in class DOMStructure
        Throws:
        javax.xml.crypto.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.