java.lang.Object
org.minidns.record.Data
org.minidns.record.DelegatingDnssecRR
Abstract base class for DNSSEC delegation records.
Provides common functionality for DNSSEC records that delegate trust from parent zones to child zones.
Provides common functionality for DNSSEC records that delegate trust from parent zones to child zones.
- See Also:
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classThe fixed fields read out of a delegation record, before it is interpreted.Field Summary
Modifier and TypeFieldDescriptionThe cryptographic algorithm used to create the signature.final byteThe byte value of the cryptographic algorithm used to create the signature.protected final byte[]The digest build from a DNSKEY.private BigIntegerCache of the digest as a number.private StringCache of the digest in hex.The algorithm used to construct the digest.final byteThe byte value of algorithm used to construct the digest.final intThe key tag value of the DNSKEY RR that validates this signature.Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDelegatingDnssecRR(int keyTag, byte algorithm, byte digestType, byte[] digest) Creates a record from wire algorithm bytes, looking up the matching enums.protectedDelegatingDnssecRR(int keyTag, DnssecConstants.SignatureAlgorithm algorithm, byte digestType, byte[] digest) Creates a record from a signature enum and a raw digest algorithm byte.protectedDelegatingDnssecRR(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.protectedDelegatingDnssecRR(int keyTag, DnssecConstants.SignatureAlgorithm algorithm, DnssecConstants.DigestAlgorithm digestType, byte[] digest) Creates a record from algorithm enums, taking the wire bytes from them.Method Summary
Modifier and TypeMethodDescriptionbooleandigestEquals(byte[] otherDigest) Compares this record's DNSKEY digest with another byte by byte.Gets the DNSKEY digest as an unsigned big-endian integer.Gets the DNSKEY digest as upper-case hexadecimal.protected static DelegatingDnssecRR.SharedDataparseSharedData(DataInputStream dis, int length) Reads the key tag, algorithm bytes and digest that DNSSEC records share.voidWrites the key tag, algorithm bytes and digest to the wire.toString()Renders the delegation as key tag, algorithms and digest.Methods inherited from class Data
equals, getType, hashCode, length, toByteArray, toOutputStream, toOutputStreamModifier and TypeMethodDescriptionfinal booleanabstract Record.TYPEgetType()The payload type.final 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
keyTag
public final int keyTagThe key tag value of the DNSKEY RR that validates this signature.algorithm
The cryptographic algorithm used to create the signature. If MiniDNS isn't aware of the signature algorithm, then this field will benull.- See Also:
algorithmByte
public final byte algorithmByteThe byte value of the cryptographic algorithm used to create the signature.digestType
The algorithm used to construct the digest. If MiniDNS isn't aware of the digest algorithm, then this field will benull.- See Also:
digestTypeByte
public final byte digestTypeByteThe byte value of algorithm used to construct the digest.digest
protected final byte[] digestThe digest build from a DNSKEY.digestBigIntCache
Cache of the digest as a number.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 signaturealgorithm- the signature algorithm, or null to derive it fromalgorithmBytealgorithmByte- the wire signature algorithm byte, asserted againstalgorithmdigestType- the digest algorithm, or null to derive it fromdigestTypeBytedigestTypeByte- the wire digest algorithm byte, asserted againstdigestTypedigest- 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 signaturealgorithm- the raw signature algorithm byte, looked up asDnssecConstants.SignatureAlgorithmdigestType- the raw digest algorithm byte, looked up asDnssecConstants.DigestAlgorithmdigest- 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 signaturealgorithm- the signature algorithm, whose number supplies the on-the-wire bytedigestType- the digest algorithm, whose value supplies the on-the-wire bytedigest- 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 signaturealgorithm- the signature algorithm, whose number supplies the on-the-wire bytedigestType- the raw digest algorithm byte, the enum being looked up from itdigest- the DNSKEY digest, which must not be null
Method Details
serialize
Writes the key tag, algorithm bytes and digest to the wire.- Specified by:
serializein classData- Parameters:
dos- the output stream to serialize to.- Throws:
IOException- if an I/O error occurs.
toString
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
Gets the DNSKEY digest as upper-case hexadecimal.- Returns:
- the DNSKEY digest as upper-case hexadecimal without a
0xprefix 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