• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class DkimSignatureHeader

A parsed DKIM-Signature header (RFC 6376 §3.5). The header value is a semicolon-separated list of tag=value pairs. Tags are short alphanumeric strings. Whitespace is allowed around semicolons and equals signs.

Inheritance
object
DkimSignatureHeader
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: DRIT.Mail.Rfc.Dkim
Assembly: DRIT.Mail.dll
Syntax
public sealed class DkimSignatureHeader

Constructors

View Source

DkimSignatureHeader(int, DkimSigningAlgorithm, string?, string?, DkimCanonicalizationMode, DkimCanonicalizationMode, string, IReadOnlyList<string>, string?, long?, string, string, DateTimeOffset?, DateTimeOffset?, IReadOnlyList<string>)

Initializes a new instance of the DkimSignatureHeader class with the specified tag values.

Declaration
public DkimSignatureHeader(int version, DkimSigningAlgorithm algorithm, string? signature, string? bodyHash, DkimCanonicalizationMode headerCanonicalization, DkimCanonicalizationMode bodyCanonicalization, string domain, IReadOnlyList<string> signedHeaders, string? identity, long? bodyLength, string queryMethod, string selector, DateTimeOffset? timestamp, DateTimeOffset? expiration, IReadOnlyList<string> copiedHeaders)
Parameters
Type Name Description
int version
DkimSigningAlgorithm algorithm
string signature
string bodyHash
DkimCanonicalizationMode headerCanonicalization
DkimCanonicalizationMode bodyCanonicalization
string domain
IReadOnlyList<string> signedHeaders
string identity
long? bodyLength
string queryMethod
string selector
DateTimeOffset? timestamp
DateTimeOffset? expiration
IReadOnlyList<string> copiedHeaders

Properties

View Source

Algorithm

Gets the signing algorithm (a=).

Declaration
public DkimSigningAlgorithm Algorithm { get; }
Property Value
Type Description
DkimSigningAlgorithm
View Source

BodyCanonicalization

Gets the body canonicalization mode (c=, second part).

Declaration
public DkimCanonicalizationMode BodyCanonicalization { get; }
Property Value
Type Description
DkimCanonicalizationMode
View Source

BodyHash

Gets the body hash (bh=, base64), or null if absent.

Declaration
public string? BodyHash { get; }
Property Value
Type Description
string
View Source

BodyLength

Gets the body length count (l=), or null if not present.

Declaration
public long? BodyLength { get; }
Property Value
Type Description
long?
View Source

CopiedHeaders

Gets the copied header fields (z=), pipe-separated list, or empty if absent.

Declaration
public IReadOnlyList<string> CopiedHeaders { get; }
Property Value
Type Description
IReadOnlyList<string>
View Source

Domain

Gets the signing domain (d=).

Declaration
public string Domain { get; }
Property Value
Type Description
string
View Source

Expiration

Gets the signature expiration (x=), or null if absent.

Declaration
public DateTimeOffset? Expiration { get; }
Property Value
Type Description
DateTimeOffset?
View Source

HeaderCanonicalization

Gets the header canonicalization mode (c=, first part).

Declaration
public DkimCanonicalizationMode HeaderCanonicalization { get; }
Property Value
Type Description
DkimCanonicalizationMode
View Source

Identity

Gets the signer identity (i=), or null if absent.

Declaration
public string? Identity { get; }
Property Value
Type Description
string
View Source

QueryMethod

Gets the query method (q=). Defaults to "dns/txt".

Declaration
public string QueryMethod { get; }
Property Value
Type Description
string
View Source

Selector

Gets the selector (s=).

Declaration
public string Selector { get; }
Property Value
Type Description
string
View Source

Signature

Gets the signature data (b=, base64), or null if absent.

Declaration
public string? Signature { get; }
Property Value
Type Description
string
View Source

SignedHeaders

Gets the signed header fields (h=), colon-separated list.

Declaration
public IReadOnlyList<string> SignedHeaders { get; }
Property Value
Type Description
IReadOnlyList<string>
View Source

Timestamp

Gets the signature timestamp (t=), or null if absent.

Declaration
public DateTimeOffset? Timestamp { get; }
Property Value
Type Description
DateTimeOffset?
View Source

Version

Gets the version tag (v=). MUST be 1.

Declaration
public int Version { get; }
Property Value
Type Description
int

Methods

View Source

Parse(string)

Parses a DKIM-Signature header value (the part after "DKIM-Signature:").

Declaration
public static DkimSignatureHeader Parse(string headerValue)
Parameters
Type Name Description
string headerValue

The header value, possibly folded.

Returns
Type Description
DkimSignatureHeader

The parsed DkimSignatureHeader.

Exceptions
Type Condition
DkimException

Thrown if the header is malformed or a required tag is missing.

View Source

ToString()

Serializes this header back to tag-value form (unfolded, single line, without the "DKIM-Signature:" prefix). Tags are emitted in a conventional order. The b= tag is included only if Signature is non-null.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()
View Source

ToString(bool)

Serializes this header to tag-value form. When includeSignature is false, the b= tag is emitted with an empty value (used during signing and verification).

Declaration
public string ToString(bool includeSignature)
Parameters
Type Name Description
bool includeSignature

The include signature used by the operation.

Returns
Type Description
string
  • View Source
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX