java.lang.Object
org.minidns.record.Data
org.minidns.record.DelegatingDnssecRR
Direct Known Subclasses:
DLV, DS

public abstract class DelegatingDnssecRRextends Data
Abstract base class for DNSSEC delegation records.
Provides common functionality for DNSSEC records that delegate trust from parent zones to child zones.
See Also:
  • Field Details

    • keyTag

      public final int keyTag
      The key tag value of the DNSKEY RR that validates this signature.
    • algorithm

      public final DnssecConstants.SignatureAlgorithm algorithm
      The cryptographic algorithm used to create the signature. If MiniDNS isn't aware of the signature algorithm, then this field will be null.
      See Also:
    • algorithmByte

      public final byte algorithmByte
      The byte value of the cryptographic algorithm used to create the signature.
    • digestType

      public final DnssecConstants.DigestAlgorithm digestType
      The algorithm used to construct the digest. If MiniDNS isn't aware of the digest algorithm, then this field will be null.
      See Also:
    • digestTypeByte

      public final byte digestTypeByte
      The byte value of algorithm used to construct the digest.
    • digest

      protected final byte[] digest
      The digest build from a DNSKEY.
    • digestBigIntCache

      private transient BigInteger digestBigIntCache
      Cache of the digest as a number.
    • digestHexCache

      private transient String digestHexCache
      Cache of the digest in hex.
  • Constructor Details

    • DelegatingDnssecRR

      protected DelegatingDnssecRR(int keyTag, DnssecConstants.SignatureAlgorithm algorithm, byte algorithmByte, DnssecConstants.DigestAlgorithm digestType, byte digestTypeByte, byte[] digest)
      Creates a record from the algorithm enums and the wire bytes they must match.
      Parameters:
      keyTag - the key tag of the DNSKEY RR that validates this delegation's signature
      algorithm - the signature algorithm, or null to derive it from algorithmByte
      algorithmByte - the wire signature algorithm byte, asserted against algorithm
      digestType - the digest algorithm, or null to derive it from digestTypeByte
      digestTypeByte - the wire digest algorithm byte, asserted against digestType
      digest - the DNSKEY digest, which must not be null
    • DelegatingDnssecRR

      protected DelegatingDnssecRR(int keyTag, byte algorithm, byte digestType, byte[] digest)
      Creates a record from wire algorithm bytes, looking up the matching enums.
      Parameters:
      keyTag - the key tag of the DNSKEY RR that validates this delegation's signature
      algorithm - the raw signature algorithm byte, looked up as DnssecConstants.SignatureAlgorithm
      digestType - the raw digest algorithm byte, looked up as DnssecConstants.DigestAlgorithm
      digest - the DNSKEY digest, which must not be null
    • DelegatingDnssecRR

      protected DelegatingDnssecRR(int keyTag, DnssecConstants.SignatureAlgorithm algorithm, DnssecConstants.DigestAlgorithm digestType, byte[] digest)
      Creates a record from algorithm enums, taking the wire bytes from them.
      Parameters:
      keyTag - the key tag of the DNSKEY RR that validates this delegation's signature
      algorithm - the signature algorithm, whose number supplies the on-the-wire byte
      digestType - the digest algorithm, whose value supplies the on-the-wire byte
      digest - the DNSKEY digest, which must not be null
    • DelegatingDnssecRR

      protected DelegatingDnssecRR(int keyTag, DnssecConstants.SignatureAlgorithm algorithm, byte digestType, byte[] digest)
      Creates a record from a signature enum and a raw digest algorithm byte.
      Parameters:
      keyTag - the key tag of the DNSKEY RR that validates this delegation's signature
      algorithm - the signature algorithm, whose number supplies the on-the-wire byte
      digestType - the raw digest algorithm byte, the enum being looked up from it
      digest - the DNSKEY digest, which must not be null
  • Method Details

    • parseSharedData

      protected static DelegatingDnssecRR.SharedData parseSharedData(DataInputStream dis, int length) throws IOException
      Reads the key tag, algorithm bytes and digest that DNSSEC records share.
      Parameters:
      dis - positioned after the fixed fields: a key tag, two algorithm bytes, then the digest
      length - the record's total length in bytes, of which the first four are fixed fields
      Returns:
      the four parsed fields, with the digest copied out of the stream
      Throws:
      IOException - if the stream ends before the digest has been read in full
    • serialize

      public void serialize(DataOutputStream dos) throws IOException
      Writes the key tag, algorithm bytes and digest to the wire.
      Specified by:
      serialize in class Data
      Parameters:
      dos - the output stream to serialize to.
      Throws:
      IOException - if an I/O error occurs.
    • toString

      public String toString()
      Renders the delegation as key tag, algorithms and digest.
      Overrides:
      toString in class Object
    • getDigestBigInteger

      public BigInteger getDigestBigInteger()
      Gets the DNSKEY digest as an unsigned big-endian integer.
      Returns:
      the DNSKEY digest as an unsigned big-endian integer, built once and then cached
    • getDigestHex

      public String getDigestHex()
      Gets the DNSKEY digest as upper-case hexadecimal.
      Returns:
      the DNSKEY digest as upper-case hexadecimal without a 0x prefix or leading zeroes, built once and then cached
    • digestEquals

      public boolean digestEquals(byte[] otherDigest)
      Compares this record's DNSKEY digest with another byte by byte.
      Parameters:
      otherDigest - the digest to compare with, element by element, so a null yields false
      Returns:
      true if both digests hold the same bytes in the same order