public TLSARecord getTLSARecord ( URL url ) { String recordValue ; int port = url . getPort ( ) ; if ( port == - 1 ) { port = url . getDefaultPort ( ) ; } String tlsaRecordName = String . format ( "_%s._tcp.%s" , port , DNSUtil . ensureDot ( url . getHost ( ) ) ) ; try { recordValue = this . dnssecResolver . resolve ( tlsaRecordName , Type . TLSA ) ; } catch ( DNSSECException e ) { return null ; } if ( recordValue . equals ( "" ) ) return null ; // Process TLSA Record String [ ] tlsaValues = recordValue . split ( " " ) ; if ( tlsaValues . length != 4 ) return null ; try { return new TLSARecord ( new Name ( tlsaRecordName ) , DClass . IN , 0 , Integer . parseInt ( tlsaValues [ 0 ] ) , Integer . parseInt ( tlsaValues [ 1 ] ) , Integer . parseInt ( tlsaValues [ 2 ] ) , BaseEncoding . base16 ( ) . decode ( tlsaValues [ 3 ] ) ) ; } catch ( TextParseException e ) { return null ; } }
Handle DNSSEC resolution for the URL s associated TLSA record