Class ValidatingResolver

  • All Implemented Interfaces:
    org.xbill.DNS.Resolver

    public class ValidatingResolver
    extends java.lang.Object
    implements org.xbill.DNS.Resolver
    This resolver validates responses with DNSSEC.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int VALIDATION_REASON_QCLASS
      The QCLASS being used for the injection of the reason why the validator came to the returned result.
    • Constructor Summary

      Constructors 
      Constructor Description
      ValidatingResolver​(org.xbill.DNS.Resolver headResolver)
      Creates a new instance of this class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TrustAnchorStore getTrustAnchors()
      Gets the store with the loaded trust anchors.
      void init​(java.util.Properties config)
      Initialize the module.
      void loadTrustAnchors​(java.io.InputStream data)
      Load the trust anchor file into the trust anchor store.
      org.xbill.DNS.Message send​(org.xbill.DNS.Message query)
      Sends a message and validates the response with DNSSEC before returning it.
      java.lang.Object sendAsync​(org.xbill.DNS.Message query, org.xbill.DNS.ResolverListener listener)
      Not implemented.
      void setEDNS​(int level)
      This is a no-op, EDNS is always set to level 0.
      void setEDNS​(int level, int payloadSize, int flags, java.util.List options)
      The method is forwarded to the resolver, but always ensure that the level is 0 and the flags contains DO.
      void setIgnoreTruncation​(boolean flag)
      This is a no-op, truncation is never ignored.
      void setPort​(int port)
      Forwards the data to the head resolver passed at construction time.
      void setTCP​(boolean flag)
      Forwards the data to the head resolver passed at construction time.
      void setTimeout​(int secs)
      Sets the amount of time to wait for a response before giving up.
      void setTimeout​(int secs, int msecs)
      Sets the amount of time to wait for a response before giving up.
      void setTSIGKey​(org.xbill.DNS.TSIG key)
      Forwards the data to the head resolver passed at construction time.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VALIDATION_REASON_QCLASS

        public static final int VALIDATION_REASON_QCLASS
        The QCLASS being used for the injection of the reason why the validator came to the returned result.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ValidatingResolver

        public ValidatingResolver​(org.xbill.DNS.Resolver headResolver)
        Creates a new instance of this class.
        Parameters:
        headResolver - The resolver to which queries for DS, DNSKEY and referring CNAME records are sent.
    • Method Detail

      • init

        public void init​(java.util.Properties config)
                  throws java.io.IOException
        Initialize the module. The only recognized configuration value is org.jitsi.dnssec.trust_anchor_file.
        Parameters:
        config - The configuration data for this module.
        Throws:
        java.io.IOException - When the file specified in the config does not exist or cannot be read.
      • loadTrustAnchors

        public void loadTrustAnchors​(java.io.InputStream data)
                              throws java.io.IOException
        Load the trust anchor file into the trust anchor store. The trust anchors are currently stored in a zone file format list of DNSKEY or DS records.
        Parameters:
        data - The trust anchor data.
        Throws:
        java.io.IOException - when the trust anchor data could not be read.
      • getTrustAnchors

        public TrustAnchorStore getTrustAnchors()
        Gets the store with the loaded trust anchors.
        Returns:
        The store with the loaded trust anchors.
      • setPort

        public void setPort​(int port)
        Forwards the data to the head resolver passed at construction time.
        Specified by:
        setPort in interface org.xbill.DNS.Resolver
        Parameters:
        port - The IP destination port for the queries sent.
        See Also:
        Resolver.setPort(int)
      • setTCP

        public void setTCP​(boolean flag)
        Forwards the data to the head resolver passed at construction time.
        Specified by:
        setTCP in interface org.xbill.DNS.Resolver
        Parameters:
        flag - true to enable TCP, false to disable it.
        See Also:
        Resolver.setTCP(boolean)
      • setIgnoreTruncation

        public void setIgnoreTruncation​(boolean flag)
        This is a no-op, truncation is never ignored.
        Specified by:
        setIgnoreTruncation in interface org.xbill.DNS.Resolver
        Parameters:
        flag - unused
      • setEDNS

        public void setEDNS​(int level)
        This is a no-op, EDNS is always set to level 0.
        Specified by:
        setEDNS in interface org.xbill.DNS.Resolver
        Parameters:
        level - unused
      • setEDNS

        public void setEDNS​(int level,
                            int payloadSize,
                            int flags,
                            java.util.List options)
        The method is forwarded to the resolver, but always ensure that the level is 0 and the flags contains DO.
        Specified by:
        setEDNS in interface org.xbill.DNS.Resolver
        Parameters:
        level - unused, always set to 0.
        payloadSize - The maximum DNS packet size that this host is capable of receiving over UDP. If 0 is specified, the default (1280) is used.
        flags - EDNS extended flags to be set in the OPT record, ExtendedFlags.DO is always appended.
        options - EDNS options to be set in the OPT record, specified as a List of OPTRecord.Option elements.
        See Also:
        Resolver.setEDNS(int, int, int, java.util.List)
      • setTSIGKey

        public void setTSIGKey​(org.xbill.DNS.TSIG key)
        Forwards the data to the head resolver passed at construction time.
        Specified by:
        setTSIGKey in interface org.xbill.DNS.Resolver
        Parameters:
        key - The key.
        See Also:
        Resolver.setTSIGKey(org.xbill.DNS.TSIG)
      • setTimeout

        public void setTimeout​(int secs,
                               int msecs)
        Sets the amount of time to wait for a response before giving up. This applies only to the head resolver, the time for an actual query to the validating resolver IS higher.
        Specified by:
        setTimeout in interface org.xbill.DNS.Resolver
        Parameters:
        secs - The number of seconds to wait.
        msecs - The number of milliseconds to wait.
      • setTimeout

        public void setTimeout​(int secs)
        Sets the amount of time to wait for a response before giving up. This applies only to the head resolver, the time for an actual query to the validating resolver IS higher.
        Specified by:
        setTimeout in interface org.xbill.DNS.Resolver
        Parameters:
        secs - The number of seconds to wait.
      • send

        public org.xbill.DNS.Message send​(org.xbill.DNS.Message query)
                                   throws java.io.IOException
        Sends a message and validates the response with DNSSEC before returning it.
        Specified by:
        send in interface org.xbill.DNS.Resolver
        Parameters:
        query - The query to send.
        Returns:
        The validated response message.
        Throws:
        java.io.IOException - An error occurred while sending or receiving.
      • sendAsync

        public java.lang.Object sendAsync​(org.xbill.DNS.Message query,
                                          org.xbill.DNS.ResolverListener listener)
        Not implemented.
        Specified by:
        sendAsync in interface org.xbill.DNS.Resolver
        Parameters:
        query - The query to send
        listener - The object containing the callbacks.
        Returns:
        An identifier, which is also a parameter in the callback
        Throws:
        java.lang.UnsupportedOperationException - Always