Dkim Signer Class
A DKIM signer.
Definition
Namespace: MimeKit.Cryptography
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
C#
public class DkimSigner : DkimSignerBase- Inheritance
- Object DkimSignerBase DkimSigner
Remarks
A DKIM signer.
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);
}
Constructors
| DkimSigner(AsymmetricKeyParameter, String, String, DkimSignatureAlgorithm) | Initialize a new instance of the DkimSigner class. |
| DkimSigner(Stream, String, String, DkimSignatureAlgorithm) | Initialize a new instance of the DkimSigner class. |
| DkimSigner(String, String, String, DkimSignatureAlgorithm) | Initialize a new instance of the DkimSigner class. |
Properties
| AgentOrUserIdentifier | Get or set the agent or user identifier. |
| BodyCanonicalizationAlgorithm |
Get or set the canonicalization algorithm to use for the message body.
(Inherited from DkimSignerBase) |
| Domain |
Get the domain that the signer represents.
(Inherited from DkimSignerBase) |
| HeaderCanonicalizationAlgorithm |
Get or set the canonicalization algorithm to use for the message headers.
(Inherited from DkimSignerBase) |
| PrivateKey |
Gets the private key.
(Inherited from DkimSignerBase) |
| QueryMethod | Get or set the public key query method. |
| Selector |
Get the selector subdividing the domain.
(Inherited from DkimSignerBase) |
| SignatureAlgorithm |
Get or set the algorithm to use for signing.
(Inherited from DkimSignerBase) |
| SignaturesExpireAfter |
Get or set the timespan after which signatures are no longer valid.
(Inherited from DkimSignerBase) |
Methods
| CreateSigningContext |
Create the digest signing context.
(Inherited from DkimSignerBase) |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
| GetHashCode | Serves as the default hash function. (Inherited from Object) |
| GetTimestamp | Get the timestamp value. |
| GetType | Gets the Type of the current instance. (Inherited from Object) |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) |
| Sign(MimeMessage, IListHeaderId) | Digitally sign the message using a DomainKeys Identified Mail (DKIM) signature. |
| Sign(MimeMessage, IListString) | Digitally sign the message using a DomainKeys Identified Mail (DKIM) signature. |
| Sign(FormatOptions, MimeMessage, IListHeaderId) | Digitally sign the message using a DomainKeys Identified Mail (DKIM) signature. |
| Sign(FormatOptions, MimeMessage, IListString) | Digitally sign the message using a DomainKeys Identified Mail (DKIM) signature. |
| ToString | Returns a string that represents the current object. (Inherited from Object) |