java.lang.Object
org.minidns.record.Data
org.minidns.record.NSEC3PARAM

public class NSEC3PARAMextends Data
DNS NSEC3PARAM record payload for DNSSEC.
Contains parameters used for NSEC3 hash calculations including algorithm, iterations, salt, and flags.
  • Field Details

    • hashAlgorithm

      public final NSEC3.HashAlgorithm hashAlgorithm
      The cryptographic hash algorithm used.
    • hashAlgorithmByte

      public final byte hashAlgorithmByte
      The cryptographic hash algorithm used.
    • flags

      public final byte flags
      Reserved flags byte; RFC 5155 requires every bit here to be zero.
    • iterations

      public final int iterations
      The number of iterations the hash algorithm is applied.
    • salt

      private final byte[] salt
      The salt appended to the next owner name before hashing.
  • Constructor Details

    • NSEC3PARAM

      private NSEC3PARAM(NSEC3.HashAlgorithm hashAlgorithm, byte hashAlgorithmByte, byte flags, int iterations, byte[] salt)
      Creates a record from its parts.
      Parameters:
      hashAlgorithm - the algorithm of the hash
      hashAlgorithmByte - the wire value of the algorithm
      flags - the flags of the record
      iterations - the number of extra hash rounds
      salt - the salt of the hash
    • NSEC3PARAM

      NSEC3PARAM(byte hashAlgorithm, byte flags, int iterations, byte[] salt)
      Create NSEC3PARAM
      Parameters:
      hashAlgorithm - the raw hash algorithm byte, mapped to a HashAlgorithm on the way in
      flags - the raw flags byte, whose reserved bits must be zero per RFC 5155
      iterations - the number of extra times the hash is applied to the next owner name
      salt - the salt prepended to the owner name before each hash
  • Method Details

    • parse

      public static NSEC3PARAM parse(DataInputStream dis) throws IOException
      Reads an NSEC3PARAM record from a stream positioned at the start of its body.
      Parameters:
      dis - the stream positioned at the start of the NSEC3PARAM record body
      Returns:
      the NSEC3PARAM record read from the stream
      Throws:
      IOException - if the stream ends before the salt, or the declared salt length is not delivered in full
    • getType

      public Record.TYPE getType()
      Returns the record type this payload belongs to.
      Specified by:
      getType in class Data
      Returns:
      The DNS record type of this payload.
    • serialize

      public void serialize(DataOutputStream dos) throws IOException
      Writes algorithm, flags, iterations and salt to the stream in wire order.
      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 four parameters as one space-separated line, with a dash for an empty salt.
      Overrides:
      toString in class Object
    • getSaltLength

      public int getSaltLength()
      Returns the length of the salt in bytes.
      Returns:
      the salt length in bytes, 0 meaning no salt