/// <summary> /// Creates a new instance of the TlsaStream class /// </summary> /// <param name="innerStream">The underlying stream on which the encrypted stream should work</param> /// <param name="resolver">A DNSSEC resolver to get the TLSA records</param> /// <param name="enforceTlsaValidation">If true, the use of TLSA records is enforced</param> /// <param name="leaveInnerStreamOpen">If true, the underlying stream will not be closed when this instance is closed</param> /// <param name="userCertificateSelectionCallback"> /// A callback to select client certificates to authenticate the client to /// the server /// </param> public DaneStream(Stream innerStream, IDnsSecResolver resolver, bool enforceTlsaValidation = false, bool leaveInnerStreamOpen = false, LocalCertificateSelectionCallback userCertificateSelectionCallback = null) : base(innerStream, leaveInnerStreamOpen) { _resolver = resolver; _enforceTlsaValidation = enforceTlsaValidation; _sslStream = new SslStream(innerStream, leaveInnerStreamOpen, ValidateRemoteCertificate, userCertificateSelectionCallback); }
/// <summary> /// Queries a dns resolver for specified records as an asynchronous operation. /// </summary> /// <typeparam name="T"> Type of records, that should be returned </typeparam> /// <param name="resolver"> The resolver instance, that should be used for queries </param> /// <param name="name"> Domain, that should be queried </param> /// <param name="recordType"> Type the should be queried </param> /// <param name="recordClass"> Class the should be queried </param> /// <param name="token"> The token to monitor cancellation requests </param> /// <returns> A list of matching <see cref="DnsRecordBase">records</see> </returns> public static Task <DnsSecResult <T> > ResolveSecureAsync <T>(this IDnsSecResolver resolver, string name, RecordType recordType = RecordType.A, RecordClass recordClass = RecordClass.INet, CancellationToken token = default(CancellationToken)) where T : DnsRecordBase { return(resolver.ResolveSecureAsync <T>(DomainName.Parse(name), recordType, recordClass, token)); }
/// <summary> /// Queries a dns resolver for specified records. /// </summary> /// <typeparam name="T"> Type of records, that should be returned </typeparam> /// <param name="resolver"> The resolver instance, that should be used for queries </param> /// <param name="name"> Domain, that should be queried </param> /// <param name="recordType"> Type the should be queried </param> /// <param name="recordClass"> Class the should be queried </param> /// <returns> The validating result and a list of matching <see cref="DnsRecordBase">records</see> </returns> public static DnsSecResult <T> ResolveSecure <T>(this IDnsSecResolver resolver, string name, RecordType recordType = RecordType.A, RecordClass recordClass = RecordClass.INet) where T : DnsRecordBase { return(resolver.ResolveSecure <T>(DomainName.Parse(name), recordType, recordClass)); }