Click or drag to resize
MimeKit

DkimSignatureAlgorithm Enumeration

A DKIM signature algorithm.

Namespace: MimeKit.Cryptography
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
public enum DkimSignatureAlgorithm
Members
Member nameValueDescription
RsaSha10 The RSA-SHA1 signature algorithm.
RsaSha2561 The RSA-SHA256 signature algorithm.
Ed25519Sha2562 The Ed25519-SHA256 signature algorithm.
Remarks
A DKIM signature algorithm.
Example
C#
public static void DkimSign (MimeMessage message)
{
    var headers = new HeaderId[] { HeaderId.From, HeaderId.Subject, HeaderId.Date };
    var signer = new DkimSigner ("privatekey.pem", "example.com", "brisbane", DkimSignatureAlgorithm.RsaSha256) {
HeaderCanonicalizationAlgorithm = DkimCanonicalizationAlgorithm.Simple,
BodyCanonicalizationAlgorithm = DkimCanonicalizationAlgorithm.Simple,
        AgentOrUserIdentifier = "@eng.example.com",
        QueryMethod = "dns/txt",
    };

    // Prepare the message body to be sent over a 7bit transport (such as older versions of SMTP).
    // Note: If the SMTP server you will be sending the message over supports the 8BITMIME extension,
    // then you can use `EncodingConstraint.EightBit` instead.
    message.Prepare (EncodingConstraint.SevenBit);

    signer.Sign (message, headers);
}
See Also