DnsTsigKey Class

A secret shared with a DNS server, used to sign the queries and to authenticate the responses with TSIG (RFC 8945). Set it in DnsClientOptions.TsigKey.

public sealed class DnsTsigKey

Constructors

NameDescription
DnsTsigKey(string, DnsTsigAlgorithm, ReadOnlySpan<byte>)Initializes a new instance of the DnsTsigKey class.

DnsTsigKey(string, DnsTsigAlgorithm, ReadOnlySpan<byte>)

DnsTsigKey.cs

Initializes a new instance of the DnsTsigKey class.

public DnsTsigKey(string name, DnsTsigAlgorithm algorithm, ReadOnlySpan<byte> secret)

Parameters

name string
The name of the key, as configured on the server (for instance transfer-key).
algorithm DnsTsigAlgorithm
The HMAC algorithm of the key.
secret ReadOnlySpan<byte>
The secret. Key files store it in base64: decode it with Convert.FromBase64String.

Exceptions

ArgumentException
name is not a valid domain name, or secret is empty.
ArgumentOutOfRangeException
algorithm is not a defined value.

Properties

NameDescription
AlgorithmGets the HMAC algorithm of the key.
FudgeGets the clock difference allowed between the client and the server. A response signed further from the current time is rejected, and the server applies the same window to the queries. Default is 5 minutes, the value RFC 8945 recommends.
NameGets the name of the key.

Algorithm

DnsTsigKey.cs

Gets the HMAC algorithm of the key.

public DnsTsigAlgorithm Algorithm { get; }

Property value

DnsTsigAlgorithm

Gets the clock difference allowed between the client and the server. A response signed further from the current time is rejected, and the server applies the same window to the queries. Default is 5 minutes, the value RFC 8945 recommends.

public TimeSpan Fudge { get; init; }

Property value

TimeSpan

Exceptions

ArgumentOutOfRangeException
The value is negative, longer than 65535 seconds, or not a whole number of seconds.

Gets the name of the key.

public string Name { get; }

Property value

string