java.lang.Object
org.minidns.record.Data
org.minidns.record.TLSA
DNS TLSA record payload for TLS certificate association.
Associates TLS certificates with domain names for DANE-based authentication of TLS services.
Associates TLS certificates with domain names for DANE-based authentication of TLS services.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe certificate usage field.static enumHow the certificate association data is hashed before comparison.static enumWhich part of the server certificate the association data covers.Field Summary
Modifier and TypeFieldDescriptionprivate static final Map<Byte, TLSA.CertUsage> Certificate usages by their number on the wire.private final byte[]The "certificate association data" to be matched.final TLSA.CertUsageThe certificate usage this field names.final byteThe provided association that will be used to match the certificate presented in the TLS handshake.private static final Map<Byte, TLSA.MatchingType> Data matching types by their number on the wire.final TLSA.MatchingTypeThe matching type this field names.final byteHow the certificate association is presented.final TLSA.SelectorThe certificate selector this field names.private static final Map<Byte, TLSA.Selector> Certificate selectors by their number on the wire.final byteWhich part of the TLS certificate presented by the server will be matched against the association data.Constructor Summary
ConstructorsConstructorDescriptionTLSA(byte certUsageByte, byte selectorByte, byte matchingTypeByte, byte[] certificateAssociation) Create TLSAMethod Summary
Modifier and TypeMethodDescriptionbooleancertificateAssociationEquals(byte[] otherCertificateAssociation) Compares the certificate association data this record carries against a candidate, byte for byte, for DANE verification.byte[]The certificate association data held by this record, defensively copied so the caller cannot modify the record's own bytes.getType()Returns the DNS record type of this record.static TLSAparse(DataInputStream dis, int length) Reads the TLSA record body from the stream.voidWrites the three header bytes followed by the association data.toString()Renders the fields and the association data in hexadecimal.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
CERT_USAGE_LUT
Certificate usages by their number on the wire.SELECTOR_LUT
Certificate selectors by their number on the wire.MATCHING_TYPE_LUT
Data matching types by their number on the wire.certUsageByte
public final byte certUsageByteThe provided association that will be used to match the certificate presented in the TLS handshake.certUsage
The certificate usage this field names.selectorByte
public final byte selectorByteWhich part of the TLS certificate presented by the server will be matched against the association data.selector
The certificate selector this field names.matchingTypeByte
public final byte matchingTypeByteHow the certificate association is presented.matchingType
The matching type this field names.certificateAssociation
private final byte[] certificateAssociationThe "certificate association data" to be matched.
Constructor Details
TLSA
TLSA(byte certUsageByte, byte selectorByte, byte matchingTypeByte, byte[] certificateAssociation) Create TLSA- Parameters:
certUsageByte- the raw certificate usage field, looked up in the LUTselectorByte- the raw selector field, looked up in the LUTmatchingTypeByte- the raw matching type field, looked up in the LUTcertificateAssociation- the certificate association data to match
Method Details
parse
Reads the TLSA record body from the stream.- Parameters:
dis- the stream positioned at the start of the record bodylength- the number of bytes the whole record occupies, of which the first three are the usage, selector and matching type- Returns:
- the TLSA record read from the stream
- Throws:
IOException- if the stream ends before the record does
getType
Returns the DNS record type of this record.serialize
Writes the three header bytes followed by the association data.- Specified by:
serializein classData- Parameters:
dos- the output stream to serialize to.- Throws:
IOException- if an I/O error occurs.
toString
getCertificateAssociation
public byte[] getCertificateAssociation()The certificate association data held by this record, defensively copied so the caller cannot modify the record's own bytes.- Returns:
- copy of the certificate association data
certificateAssociationEquals
public boolean certificateAssociationEquals(byte[] otherCertificateAssociation) Compares the certificate association data this record carries against a candidate, byte for byte, for DANE verification.- Parameters:
otherCertificateAssociation- the association data to compare against- Returns:
- true if the given data matches the certificate association