Class EPPSecDNSExtKeyData

  • All Implemented Interfaces:
    EPPCodecComponent, java.io.Serializable, java.lang.Cloneable

    public class EPPSecDNSExtKeyData
    extends java.lang.Object
    implements EPPCodecComponent
    The EPPSecDNSExtKeyData is the EPPCodecComponent that knows how to encode and decode secDNS keyData elements from/to XML and object instance.

    Title: EPP 1.0 secDNS

    Description: secDNS Extension to the EPP SDK

    Copyright: Copyright (c) 2010

    Company: VeriSign

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      EPPSecDNSExtKeyData()
      Create a new instance of EPPSecDNSExtKeyData
      EPPSecDNSExtKeyData​(int flags, int protocol, int alg, java.lang.String pubKey)
      Create a new instance of EPPSecDNSExtKeyData with the given values.
      EPPSecDNSExtKeyData​(EPPSecDNSExtKeyData keyData)
      Create a new instance (copy) of EPPSecDNSExtKeyData
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Clone EPPSecDNSExtKeyData.
      void decode​(org.w3c.dom.Element aElement)
      Populate the data of this instance with the data stored in the given Element of the DOM tree
      org.w3c.dom.Element encode​(org.w3c.dom.Document aDocument)
      Append all data from this secDNS:keyData to the given DOM Document
      boolean equals​(java.lang.Object aObject)
      implements a deep EPPSecDNSExtKeyData compare.
      int getAlg()
      Get secDNS:alg value
      int getFlags()
      Get secDNS:flags value
      java.lang.String getNamespace()
      Returns the XML namespace associated with the EPPCodecComponent.
      int getProtocol()
      Get secDNS:protocol value
      java.lang.String getPubKey()
      Get secDNS:pubKey value
      void setAlg​(int alg)
      Set secDNS:alg value
      void setFlags​(int flags)
      Set secDNS:flags value
      void setProtocol​(int protocol)
      Set secDNS:protocol value
      void setPubKey​(java.lang.String pubKey)
      Set secDNS:pubKey value This method will remove all whitespace in an effort to produce the canonical representation for base64Binary as defined by http://www.w3.org/TR/xmlschema-2/#base64Binary
      EPPSecDNSExtDsData toDsData​(java.lang.String aDomainName, int aDigestType)
      Generates a EPPSecDNSExtDsData with the key data utilizing the domain name (aDomainName) and the desired digest type ( aDigestType).
      int toKeyTag()
      Generate the key tag used in the DS data and included in the EPPSecDNSExtDsData return by toDsData(String, int).
      java.lang.String toString()
      Implementation of Object.toString, which will result in an indented XML String representation of the concrete EPPCodecComponent.
      • Methods inherited from class java.lang.Object

        finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT_PROTOCOL

        public static final int DEFAULT_PROTOCOL
        The default protocol vale. http://www.ietf.org/rfc/rfc4034.txt 2.1.2. The Protocol Field The Protocol Field MUST have value 3, and the DNSKEY RR MUST be treated as invalid during signature verification if it is found to be some value other than 3.
        See Also:
        Constant Field Values
      • FLAGS_ZONE_KEY

        public static final int FLAGS_ZONE_KEY
        Bit 7 of the Flags field is the Zone Key flag. If bit 7 has value 1, then the DNSKEY record holds a DNS zone key.
        See Also:
        Constant Field Values
      • FLAGS_ZONE_KEY_SEP

        public static final int FLAGS_ZONE_KEY_SEP
        Bit 15 of the Flags field is the Secure Entry Point flag. If bit 15 has value 1, then the DNSKEY record holds a key intended for use as a secure entry point (SEP).
        See Also:
        Constant Field Values
      • UNSPEC_FLAGS

        public static final int UNSPEC_FLAGS
        Unspecified flags value
        See Also:
        Constant Field Values
      • UNSPEC_PROTOCOL

        public static final int UNSPEC_PROTOCOL
        Unspecified protocol value
        See Also:
        Constant Field Values
      • MIN_PROTOCOL

        public static final int MIN_PROTOCOL
        Minimum protocol value
        See Also:
        Constant Field Values
      • MAX_PROTOCOL

        public static final int MAX_PROTOCOL
        Maximum protocol value
        See Also:
        Constant Field Values
    • Constructor Detail

      • EPPSecDNSExtKeyData

        public EPPSecDNSExtKeyData()
        Create a new instance of EPPSecDNSExtKeyData
      • EPPSecDNSExtKeyData

        public EPPSecDNSExtKeyData​(EPPSecDNSExtKeyData keyData)
        Create a new instance (copy) of EPPSecDNSExtKeyData
        Parameters:
        keyData - EPPSecDNSExtKeyData instance
      • EPPSecDNSExtKeyData

        public EPPSecDNSExtKeyData​(int flags,
                                   int protocol,
                                   int alg,
                                   java.lang.String pubKey)
        Create a new instance of EPPSecDNSExtKeyData with the given values.
        Parameters:
        flags - the flags value to use for this instance.
        protocol - the protocol value to use for this instance.
        alg - the algorithm value to use for this instance.
        pubKey - the public key value to use for this instance.
    • Method Detail

      • encode

        public org.w3c.dom.Element encode​(org.w3c.dom.Document aDocument)
                                   throws EPPEncodeException
        Append all data from this secDNS:keyData to the given DOM Document
        Specified by:
        encode in interface EPPCodecComponent
        Parameters:
        aDocument - The DOM Document to append data to
        Returns:
        Encoded DOM Element
        Throws:
        EPPEncodeException - Thrown when errors occur during the encode attempt or if the instance is invalid.
      • decode

        public void decode​(org.w3c.dom.Element aElement)
                    throws EPPDecodeException
        Populate the data of this instance with the data stored in the given Element of the DOM tree
        Specified by:
        decode in interface EPPCodecComponent
        Parameters:
        aElement - The root element of the fragment of XML
        Throws:
        EPPDecodeException - Thrown if any errors occur during decoding.
      • equals

        public boolean equals​(java.lang.Object aObject)
        implements a deep EPPSecDNSExtKeyData compare.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        aObject - EPPSecDNSExtKeyData instance to compare with
        Returns:
        true if equal false otherwise
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Clone EPPSecDNSExtKeyData.
        Specified by:
        clone in interface EPPCodecComponent
        Overrides:
        clone in class java.lang.Object
        Returns:
        clone of EPPSecDNSExtKeyData
        Throws:
        java.lang.CloneNotSupportedException - standard Object.clone exception
      • getFlags

        public int getFlags()
        Get secDNS:flags value
        Returns:
        an int value representing secDNS:flags
        See Also:
        UNSPEC_FLAGS
      • setFlags

        public void setFlags​(int flags)
        Set secDNS:flags value
        Parameters:
        flags - an int value representing secDNS:flags
        See Also:
        FLAGS_ZONE_KEY_SEP, FLAGS_ZONE_KEY
      • getProtocol

        public int getProtocol()
        Get secDNS:protocol value
        Returns:
        an int value representing secDNS:protocol
        See Also:
        DEFAULT_PROTOCOL, UNSPEC_PROTOCOL
      • setProtocol

        public void setProtocol​(int protocol)
        Set secDNS:protocol value
        Parameters:
        protocol - an int value representing secDNS:protocol
      • getAlg

        public int getAlg()
        Get secDNS:alg value
        Returns:
        an int value representing secDNS:alg
        See Also:
        UNSPEC_ALG
      • setAlg

        public void setAlg​(int alg)
        Set secDNS:alg value
        Parameters:
        alg - an int value representing secDNS:alg
      • getPubKey

        public java.lang.String getPubKey()
        Get secDNS:pubKey value
        Returns:
        the canonical representation of the base64Binary secDNS:pubKey
        See Also:
        setPubKey(String pubKey)
      • setPubKey

        public void setPubKey​(java.lang.String pubKey)
        Set secDNS:pubKey value This method will remove all whitespace in an effort to produce the canonical representation for base64Binary as defined by http://www.w3.org/TR/xmlschema-2/#base64Binary
        Parameters:
        pubKey - an String value representing the base64Binary secDNS:pubKey
        See Also:
        EPPUtil.removeWhitespace(String inString)
      • toString

        public java.lang.String toString()
        Implementation of Object.toString, which will result in an indented XML String representation of the concrete EPPCodecComponent.
        Overrides:
        toString in class java.lang.Object
        Returns:
        Indented XML String if successful; ERROR otherwise.
      • toDsData

        public EPPSecDNSExtDsData toDsData​(java.lang.String aDomainName,
                                           int aDigestType)
                                    throws EPPCodecException
        Generates a EPPSecDNSExtDsData with the key data utilizing the domain name (aDomainName) and the desired digest type ( aDigestType). The DS data is generated based on RFC 4032, where the DS digest is calculated as shown below:
        "|" denotes concatenation
        digest = digest_algorithm( DNSKEY owner name | DNSKEY RDATA);
        DNSKEY RDATA = Flags | Protocol | Algorithm | Public Key
        Parameters:
        aDomainName - Domain name / owner name of DNSKEY
        aDigestType - Desired digest type of generated DS using a EPPSecDNSExtDsData DIGEST_TYPE constant like EPPSecDNSExtDsData.SHA1_DIGEST_TYPE or EPPSecDNSExtDsData.SHA256_DIGEST_TYPE.
        Returns:
        Instance of EPPSecDNSExtDsData representing the generated DS data
        Throws:
        EPPCodecException - On error generating the DS data
      • getNamespace

        public java.lang.String getNamespace()
        Returns the XML namespace associated with the EPPCodecComponent.
        Specified by:
        getNamespace in interface EPPCodecComponent
        Returns:
        XML namespace for the EPPCodecComponent.