java.lang.Object
org.minidns.record.Data
org.minidns.record.NSEC3PARAM
DNS NSEC3PARAM record payload for DNSSEC.
Contains parameters used for NSEC3 hash calculations including algorithm, iterations, salt, and flags.
Contains parameters used for NSEC3 hash calculations including algorithm, iterations, salt, and flags.
Field Summary
Modifier and TypeFieldDescriptionfinal byteReserved flags byte; RFC 5155 requires every bit here to be zero.final NSEC3.HashAlgorithmThe cryptographic hash algorithm used.final byteThe cryptographic hash algorithm used.final intThe number of iterations the hash algorithm is applied.private final byte[]The salt appended to the next owner name before hashing.Constructor Summary
ConstructorsModifierConstructorDescription(package private)NSEC3PARAM(byte hashAlgorithm, byte flags, int iterations, byte[] salt) Create NSEC3PARAMprivateNSEC3PARAM(NSEC3.HashAlgorithm hashAlgorithm, byte hashAlgorithmByte, byte flags, int iterations, byte[] salt) Creates a record from its parts.Method Summary
Modifier and TypeMethodDescriptionintReturns the length of the salt in bytes.getType()Returns the record type this payload belongs to.static NSEC3PARAMparse(DataInputStream dis) Reads an NSEC3PARAM record from a stream positioned at the start of its body.voidWrites algorithm, flags, iterations and salt to the stream in wire order.toString()Renders the four parameters as one space-separated line, with a dash for an empty salt.Methods inherited from class Data
equals, hashCode, length, toByteArray, toOutputStream, toOutputStreamModifier and TypeMethodDescriptionfinal booleanfinal inthashCode()final intlength()Serialize this record, if that has not been done already, and report the resulting wire size.final byte[]Serialize this record, if that has not been done already, and return a copy of the result so callers cannot mutate the cached bytes.final voidWrite the binary representation of this payload to the givenDataOutputStream.final voidtoOutputStream(OutputStream outputStream) Write the binary representation to the given OutputStream.
Field Details
hashAlgorithm
The cryptographic hash algorithm used.hashAlgorithmByte
public final byte hashAlgorithmByteThe cryptographic hash algorithm used.flags
public final byte flagsReserved flags byte; RFC 5155 requires every bit here to be zero.iterations
public final int iterationsThe number of iterations the hash algorithm is applied.salt
private final byte[] saltThe 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 hashhashAlgorithmByte- the wire value of the algorithmflags- the flags of the recorditerations- the number of extra hash roundssalt- 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 inflags- the raw flags byte, whose reserved bits must be zero per RFC 5155iterations- the number of extra times the hash is applied to the next owner namesalt- the salt prepended to the owner name before each hash
Method Details
parse
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
Returns the record type this payload belongs to.serialize
Writes algorithm, flags, iterations and salt to the stream in wire order.- Specified by:
serializein classData- Parameters:
dos- the output stream to serialize to.- Throws:
IOException- if an I/O error occurs.
toString
getSaltLength
public int getSaltLength()Returns the length of the salt in bytes.- Returns:
- the salt length in bytes, 0 meaning no salt