ChilkatDkim ActiveX Reference

ChilkatDkim

DomainKeys API for creating and verifying DKIM-Signature and DomainKey-Signature MIME (email) header fields. This API is included with the "Chilkat MIME" license. ("Chilkat MIME" may be referred to as "Chilkat S/MIME" on some chilkatsoft.com web pages. They are the same product.)

Object Creation

(Visual Basic 6.0)
Dim obj As New ChilkatDkim
(ASP)
set obj = Server.CreateObject("Chilkat.Dkim")
(VBScript)
set obj = CreateObject("Chilkat.Dkim")
(Delphi)
obj := TChilkatDkim.Create(Self);
(FoxPro)
loObject = CreateObject('Chilkat.Dkim')
(SQL Server)
EXEC @hr = sp_OACreate 'Chilkat.Dkim', @obj OUT
(Javascript)
var obj = new ActiveXObject("Chilkat.Dkim");

Properties

DkimAlg As String

The signing algorithm to be used in creating the DKIM-Signature. Possible values are "rsa-sha256" and "rsa-sha1". The default value is "rsa-sha256".

DkimBodyLengthCount As Long

Optional body length count to set a maximum number of body bytes to be hashed when creating the DKIM-Signature field. The default value is 0, indicating that the entire body should be hashed.

DkimCanon As String

Canonicalization algorithm to be used for both header and body when creating the DKIM-Signature. Possible values are "simple" and "relaxed". The default value is "relaxed".

DkimDomain As String

The domain name of the signing domain when creating the DKIM-Signature.

DkimHeaders As String

A colon-separated list of header field names that identify headers presented to the signing algorithm when creating the DKIM-Signature. The default value is: "mime-version:date:message-id:subject:from:to:content-type".

DkimSelector As String

The selector to be used to form the DNS query for the public key. This property applies to creating a DKIM-Signature. For example, if the selector is "reykjavik" and the domain is "example-code.com", then the DNS query would be for "reykjavik._domainkey.example-code.com".

DomainKeyAlg As String

The signing algorithm to be used in creating the DomainKey-Signature. The only possible value is "rsa-sha1". The default value is "rsa-sha1".

DomainKeyCanon As String

Canonicalization algorithm to be used for when creating the DomainKey-Signature. Possible values are "simple" and "nofws". The default value is "nofws".

DomainKeyDomain As String

The domain name of the signing domain when creating the DomainKey-Signature.

DomainKeyHeaders As String

A colon-separated list of header field names that identify headers presented to the signing algorithm when creating the DomainKey-Signature. The default value is: "mime-version:date:message-id:subject:from:to:content-type".

DomainKeySelector As String

The selector to be used to form the DNS query for the public key. This property applies to creating a DomainKey-Signature. For example, if the selector is "reykjavik" and the domain is "example-code.com", then the DNS query would be for "reykjavik._domainkey.example-code.com".

LastErrorHtml As String (read-only)

Error information in HTML format for the last method called.

LastErrorText As String (read-only)

Error information in plain-text format for the last method called.

LastErrorXml As String (read-only)

Error information in XML format for the last method called.

Methods

AddDkimSignature(mimeIn As Variant) As Variant

Constructs and prepends a DKIM-Signature header to the MIME. Prior to calling this method, your program must set both the DkimDomain and DkimSelector properties, and it must load a private key by calling LoadDkimPk or LoadDkimPkFile.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

(ASP) Add DKIM-Signature Header to MIME / Email

(VB6) Add DKIM-Signature Header to MIME / Email

(Delphi) Add DKIM-Signature Header to MIME / Email

(FoxPro) Add DKIM-Signature Header to MIME / Email

(PHP using ActiveX) Add DKIM-Signature Header to MIME / Email

(VBScript) Add DKIM-Signature Header to MIME / Email

(ASP) Send DKIM Signed Email

(VB6) Send DKIM Signed Email

(Delphi) Send DKIM Signed Email

(FoxPro) Send DKIM Signed Email

(PHP using ActiveX) Send DKIM Signed Email

(VBScript) Send DKIM Signed Email

AddDomainKeySignature(mimeIn As Variant) As Variant

Constructs and prepends a DomainKey-Signature header to the MIME. Prior to calling this method, your program must set both the DomainKeyDomain and DomainKeySelector properties, and it must load a private key by calling LoadDomainKeyPk or LoadDomainKeyPkFile.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

(ASP) Add DomainKey-Signature Header to MIME / Email

(VB6) Add DomainKey-Signature Header to MIME / Email

(Delphi) Add DomainKey-Signature Header to MIME / Email

(FoxPro) Add DomainKey-Signature Header to MIME / Email

(PHP using ActiveX) Add DomainKey-Signature Header to MIME / Email

(VBScript) Add DomainKey-Signature Header to MIME / Email

LoadDkimPk(privateKey As String, optionalPassword As String) As Long

Loads an RSA private key to be used for creating a DKIM-Signature. Any valid RSA private key format that is not binary, such as PEM or XML, may be passed to this method. This method will automatically determine the format and parse it correctly. A password is only required if key is encrypted, such as for encrypted PEM.

Returns 1 for success, 0 for failure.

LoadDkimPkBytes(privateKeyDer As Variant, optionalPassword As String) As Long

Loads an RSA private key to be used for creating a DKIM-Signature. Any valid RSA private key binary format, such as DER, may be passed to this method. This method will automatically determine the format and parse it correctly. A password is only required if key is encrypted.

Returns 1 for success, 0 for failure.

LoadDkimPkFile(privateKeyFilePath As String, optionalPassword As String) As Long

Loads an RSA private key file to be used for creating a DKIM-Signature. The file name contains any valid RSA private key format, such as DER, PKCS8, PEM, XML, etc. This method will automatically determine the format and parse it correctly. A password is only required if key is encrypted, such as for encrypted PEM or encrypted PKCS8.

Returns 1 for success, 0 for failure.

LoadDomainKeyPk(privateKey As String, optionalPassword As String) As Long

Loads an RSA private key to be used for creating a DomainKey-Signature. Any valid RSA private key format that is not binary, such as PEM or XML, may be passed to this method. This method will automatically determine the format and parse it correctly. A password is only required if key is encrypted, such as for encrypted PEM.

Returns 1 for success, 0 for failure.

LoadDomainKeyPkBytes(privateKeyDer As Variant, optionalPassword As String) As Long

Loads an RSA private key to be used for creating a DomainKey-Signature. Any valid RSA private key binary format, such as DER, may be passed to this method. This method will automatically determine the format and parse it correctly. A password is only required if key is encrypted.

Returns 1 for success, 0 for failure.

LoadDomainKeyPkFile(privateKeyFilePath As String, optionalPassword As String) As Long

Loads an RSA private key file to be used for creating a DomainKey-Signature. The file name contains any valid RSA private key format, such as DER, PKCS8, PEM, XML, etc. This method will automatically determine the format and parse it correctly. A password is only required if key is encrypted, such as for encrypted PEM or encrypted PKCS8.

Returns 1 for success, 0 for failure.

LoadPublicKey(selector As String, domain As String, publicKey As String) As Long

Caches a public key to be used for verifying DKIM and DomainKey signatures for a given selector and domain. The publicKey is a string containing an RSA public key in any text format, such as XML, PEM, etc. This method will automatically detect the format and load the public key correctly. This method is useful for testing DKIM and DomainKey verification when your public key has not yet been installed in DNS.

Returns 1 for success, 0 for failure.

LoadPublicKeyFile(selector As String, domain As String, publicKeyFilepath As String) As Long

Caches a public key to be used for verifying DKIM and DomainKey signatures for a given selector and domain. The publicKeyFilepath is a filepath of an RSA public key in any format. This method will automatically detect the format and load the public key correctly. This method is useful for testing DKIM and DomainKey verification when your public key has not yet been installed in DNS.

Returns 1 for success, 0 for failure.

NumDkimSignatures(mimeData As Variant) As Long

Returns the number of DKIM-Signature header fields found in mimeData.

NumDomainKeySignatures(mimeData As Variant) As Long

Returns the number of DomainKey-Signature header fields found in mimeData.

PrefetchPublicKey(selector As String, domain As String) As Long

Useful if your application is going to verify many emails from a single domain (or a few domains). This eliminates the need to do a DNS lookup to fetch the public key each time an email's DKIM or DomainKey signature is verified.

This method may be called multiple times -- once for each selector/domain to be pre-fetched. The verify methods (VerifyDkimSignature and VerifyDomainKeySignature) will use a pre-fetched key if the selector and domain match.

Returns 1 for success, 0 for failure.

SaveLastError(filename As String) As Long

Saves the last error information to an XML formatted file.

UnlockComponent(unlockCode As String) As Long

Unlocks the component allowing for the full functionality to be used. If this method unexpectedly returns 0, examine the contents of the LastErrorText property to determine the reason for failure.

Returns 1 for success, 0 for failure.

VerifyDkimSignature(sigIndex As Long, mimeData As Variant) As Long

Verifies the Nth DKIM-Signature header in the mimeData. (In most cases, there is only one signature.) The 1st signature is at sigIndex 0.

Important: Many anti-virus programs, such as AVG, will modify the MIME of an email as it is received. This will cause DKIM signature verification to fail because the body of the MIME is modified.

Returns 1 for success, 0 for failure.

VerifyDomainKeySignature(sigIndex As Long, mimeData As Variant) As Long

Verifies the Nth DomainKey-Signature header in the mimeData. (In most cases, there is only one signature.) The 1st signature is at sigIndex 0.

Important: Many anti-virus programs, such as AVG, will modify the MIME of an email as it is received. This will cause DomainKey signature verification to fail because the body of the MIME is modified.

Returns 1 for success, 0 for failure.