Class DkimKeyRecord
A parsed DKIM key record from DNS (RFC 6376 §3.6.1). The record is stored
as a TXT record at <selector>._domainkey.<domain> and
contains tag-value pairs describing the public key and its constraints.
Inherited Members
Namespace: DRIT.Mail.Rfc.Dkim
Assembly: DRIT.Mail.dll
Syntax
public sealed class DkimKeyRecord
Constructors
View SourceDkimKeyRecord(string?, string, string?, IReadOnlyList<string>, string, IReadOnlyList<string>, string?)
Initializes a new instance of the DkimKeyRecord class.
Declaration
public DkimKeyRecord(string? version, string keyType, string? publicKey, IReadOnlyList<string> hashAlgorithms, string serviceType, IReadOnlyList<string> flags, string? notes)
Parameters
| Type | Name | Description |
|---|---|---|
| string | version | |
| string | keyType | |
| string | publicKey | |
| IReadOnlyList<string> | hashAlgorithms | |
| string | serviceType | |
| IReadOnlyList<string> | flags | |
| string | notes |
Properties
View SourceFlags
Gets the flags (t=), or empty if not specified. Common values: "y" (testing), "s" (no subdomains).
Declaration
public IReadOnlyList<string> Flags { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
HashAlgorithms
Gets the acceptable hash algorithms (h=), or empty if not specified.
Declaration
public IReadOnlyList<string> HashAlgorithms { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
IsRevoked
Gets a value indicating whether the key has been revoked (p= is empty or absent).
Declaration
public bool IsRevoked { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsTesting
Gets a value indicating whether the key is in testing mode (t= contains "y").
Declaration
public bool IsTesting { get; }
Property Value
| Type | Description |
|---|---|
| bool |
KeyType
Gets the key type (k=). Defaults to "rsa".
Declaration
public string KeyType { get; }
Property Value
| Type | Description |
|---|---|
| string |
NoSubdomains
Gets a value indicating whether the key must not be used for subdomains (t= contains "s").
Declaration
public bool NoSubdomains { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Notes
Gets the notes (n=), or null if absent.
Declaration
public string? Notes { get; }
Property Value
| Type | Description |
|---|---|
| string |
PublicKey
Gets the public key data (p=, base64-encoded DER RSAPublicKey). Empty string means the key has been revoked. Null if the tag is absent.
Declaration
public string? PublicKey { get; }
Property Value
| Type | Description |
|---|---|
| string |
ServiceType
Gets the service type (s=). Defaults to "email".
Declaration
public string ServiceType { get; }
Property Value
| Type | Description |
|---|---|
| string |
Version
Gets the version tag (v=). Should be "DKIM1" if present. Defaults to "DKIM1".
Declaration
public string? Version { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceParse(string)
Parses a DKIM key record (the full TXT record value).
Declaration
public static DkimKeyRecord Parse(string record)
Parameters
| Type | Name | Description |
|---|---|---|
| string | record | The key record text. |
Returns
| Type | Description |
|---|---|
| DkimKeyRecord | The parsed DkimKeyRecord. |
Exceptions
| Type | Condition |
|---|---|
| DkimException | Thrown if the record is malformed. |