java.lang.Object
org.minidns.record.Data
org.minidns.record.NSEC3
DNS NSEC3 (Next Secure 3) record payload for DNSSEC.
Provides authenticated denial of existence with hashed names to prevent zone enumeration attacks.
Provides authenticated denial of existence with hashed names to prevent zone enumeration attacks.
Nested Class Summary
Nested ClassesField Summary
FieldsModifier and TypeFieldDescriptionstatic final byteThis Flag indicates whether this NSEC3 RR may cover unsigned delegations.final byteBitmap of flags:FLAG_OPT_OUT.final NSEC3.HashAlgorithmThe cryptographic hash algorithm used.final byteThe byte value of the cryptographic hash algorithm used.final intThe number of iterations the hash algorithm is applied.final List<Record.TYPE> The RR types existing at the original owner name.Constructor Summary
ConstructorsConstructorDescriptionNSEC3(byte hashAlgorithm, byte flags, int iterations, byte[] salt, byte[] nextHashed, List<Record.TYPE> types) Create an NSEC3 record from its fields.NSEC3(byte hashAlgorithm, byte flags, int iterations, byte[] salt, byte[] nextHashed, Record.TYPE... types) Create an NSEC3 record from its fields.Method Summary
Modifier and TypeMethodDescriptionvoidcopySaltInto(byte[] dest, int destPos) Copy the salt into a caller-supplied buffer.byte[]Returns a defensive copy of the next owner name in hash order.getNextHashedBase32.Returns the next hashed owner name as a DNS label, decoding the cached Base32 form.byte[]getSalt()Returns a defensive copy of the salt prepended to the owner name.intReturns the number of salt bytes carried by this record.getType()The DNS RR type of this record, always TYPE.NSEC3.static NSEC3parse(DataInputStream dis, int length) Parse an NSEC3 record payload from a stream.voidWrite this record's payload to a stream.toString()Render the record in the dig-style presentation format.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
FLAG_OPT_OUT
public static final byte FLAG_OPT_OUTThis Flag indicates whether this NSEC3 RR may cover unsigned delegations.- See Also:
hashAlgorithm
The cryptographic hash algorithm used. If MiniDNS isn't aware of the hash algorithm, then this field will benull.- See Also:
hashAlgorithmByte
public final byte hashAlgorithmByteThe byte value of the cryptographic hash algorithm used.flags
public final byte flagsBitmap of flags:FLAG_OPT_OUT.iterations
public final int iterationsThe number of iterations the hash algorithm is applied.types
The RR types existing at the original owner name.
Constructor Details
NSEC3
public NSEC3(byte hashAlgorithm, byte flags, int iterations, byte[] salt, byte[] nextHashed, List<Record.TYPE> types) Create an NSEC3 record from its fields.- Parameters:
hashAlgorithm- the hash algorithm byte as it appears in the recordflags- the flag bitmap, see FLAG_OPT_OUTiterations- the number of extra hash iterations, 0 to 65535salt- the salt prepended to the owner name before hashingnextHashed- the next existing owner name in hash ordertypes- the RR types present at the original owner name
NSEC3
public NSEC3(byte hashAlgorithm, byte flags, int iterations, byte[] salt, byte[] nextHashed, Record.TYPE... types) Create an NSEC3 record from its fields.- Parameters:
hashAlgorithm- the hash algorithm byte as it appears in the recordflags- the flag bitmap, see FLAG_OPT_OUTiterations- the number of extra hash iterations, 0 to 65535salt- the salt prepended to the owner name before hashingnextHashed- the next existing owner name in hash ordertypes- the RR types present at the original owner name
Method Details
parse
Parse an NSEC3 record payload from a stream.- Parameters:
dis- the stream positioned at the start of the recordlength- the total length of the record in the stream, used to size the type bitmap- Returns:
- the parsed record
- Throws:
IOException- if the stream ends inside a field or the declared lengths do not add up to the record length
getType
The DNS RR type of this record, always TYPE.NSEC3.serialize
Write this record's payload to a stream.- Specified by:
serializein classData- Parameters:
dos- the stream to write the record fields to- Throws:
IOException- if the stream rejects the write
toString
getSalt
public byte[] getSalt()Returns a defensive copy of the salt prepended to the owner name.- Returns:
- a copy of the salt prepended to the owner name before hashing
getSaltLength
public int getSaltLength()Returns the number of salt bytes carried by this record.- Returns:
- the number of salt bytes, from 0 to 255
getNextHashed
public byte[] getNextHashed()Returns a defensive copy of the next owner name in hash order.- Returns:
- a copy of the next existing owner name in hash order
getNextHashedBase32
getNextHashedBase32.- Returns:
- the next hashed owner name, Base32 encoded and cached after the first call
getNextHashedDnsLabel
Returns the next hashed owner name as a DNS label, decoding the cached Base32 form.- Returns:
- the next hashed owner name as a DNS label, cached after the first call
copySaltInto
public void copySaltInto(byte[] dest, int destPos) Copy the salt into a caller-supplied buffer.- Parameters:
dest- buffer that receives the salt bytesdestPos- offset in dest at which to write the salt