CkDkim Java Programming Reference Documentation
CkDkim
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
CkDkim obj = new CkDkim();
Properties
// str is a CkString object (output) get_DkimAlg( str )
// newVal is a string (input) put_DkimAlg( newVal )
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".
// Returns an integer value get_DkimBodyLengthCount( )
// newVal is an integer (input) put_DkimBodyLengthCount( newVal )
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.
// str is a CkString object (output) get_DkimCanon( str )
// newVal is a string (input) put_DkimCanon( newVal )
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".
// str is a CkString object (output) get_DkimDomain( str )
// newVal is a string (input) put_DkimDomain( newVal )
The domain name of the signing domain when creating the DKIM-Signature.
// str is a CkString object (output) get_DkimHeaders( str )
// newVal is a string (input) put_DkimHeaders( newVal )
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".
// str is a CkString object (output) get_DkimSelector( str )
// newVal is a string (input) put_DkimSelector( newVal )
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".
// str is a CkString object (output) get_DomainKeyAlg( str )
// newVal is a string (input) put_DomainKeyAlg( newVal )
The signing algorithm to be used in creating the DomainKey-Signature. The only possible value is "rsa-sha1". The default value is "rsa-sha1".
// str is a CkString object (output) get_DomainKeyCanon( str )
// newVal is a string (input) put_DomainKeyCanon( newVal )
Canonicalization algorithm to be used for when creating the DomainKey-Signature. Possible values are "simple" and "nofws". The default value is "nofws".
// str is a CkString object (output) get_DomainKeyDomain( str )
// newVal is a string (input) put_DomainKeyDomain( newVal )
The domain name of the signing domain when creating the DomainKey-Signature.
// str is a CkString object (output) get_DomainKeyHeaders( str )
// newVal is a string (input) put_DomainKeyHeaders( newVal )
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".
// str is a CkString object (output) get_DomainKeySelector( str )
// newVal is a string (input) put_DomainKeySelector( newVal )
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".
// str is a CkString object (output) LastErrorHtml( str )
Error information in HTML format for the last method called.
// str is a CkString object (output) LastErrorText( str )
Error information in plain-text format for the last method called.
// str is a CkString object (output) LastErrorXml( str )
Error information in XML format for the last method called.
Methods
// mimeIn is a CkByteData object (output) // mimeOut is a CkByteData object (output) // Returns a boolean value AddDkimSignature( mimeIn, mimeOut )
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. (Java) Add DKIM-Signature Header to MIME / Email (Java) Send DKIM Signed Email
// mimeIn is a CkByteData object (output) // outBytes is a CkByteData object (output) // Returns a boolean value AddDomainKeySignature( mimeIn, outBytes )
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. (Java) Add DomainKey-Signature Header to MIME / Email
// privateKey is a string (input) // optionalPassword is a string (input) // Returns a boolean value LoadDkimPk( privateKey, optionalPassword )
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 true for success, false for failure.
// privateKeyDer is a CkByteData object (output) // optionalPassword is a string (input) // Returns a boolean value LoadDkimPkBytes( privateKeyDer, optionalPassword )
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 true for success, false for failure.
// privateKeyFilePath is a string (input) // optionalPassword is a string (input) // Returns a boolean value LoadDkimPkFile( privateKeyFilePath, optionalPassword )
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 true for success, false for failure.
// privateKey is a string (input) // optionalPassword is a string (input) // Returns a boolean value LoadDomainKeyPk( privateKey, optionalPassword )
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 true for success, false for failure.
// privateKeyDer is a CkByteData object (output) // optionalPassword is a string (input) // Returns a boolean value LoadDomainKeyPkBytes( privateKeyDer, optionalPassword )
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 true for success, false for failure.
// privateKeyFilePath is a string (input) // optionalPassword is a string (input) // Returns a boolean value LoadDomainKeyPkFile( privateKeyFilePath, optionalPassword )
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 true for success, false for failure.
// selector is a string (input) // domain is a string (input) // publicKey is a string (input) // Returns a boolean value LoadPublicKey( selector, domain, publicKey )
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 true for success, false for failure.
// selector is a string (input) // domain is a string (input) // publicKeyFilepath is a string (input) // Returns a boolean value LoadPublicKeyFile( selector, domain, publicKeyFilepath )
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 true for success, false for failure.
// mimeData is a CkByteData object (output) // Returns an integer value NumDkimSignatures( mimeData )
Returns the number of DKIM-Signature header fields found in mimeData.
// mimeData is a CkByteData object (output) // Returns an integer value NumDomainKeySignatures( mimeData )
Returns the number of DomainKey-Signature header fields found in mimeData.
// selector is a string (input) // domain is a string (input) // Returns a boolean value PrefetchPublicKey( selector, domain )
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 true for success, false for failure.
// filename is a string (input) // Returns a boolean value SaveLastError( filename )
Saves the last error information to an XML formatted file.
// unlockCode is a string (input) // Returns a boolean value UnlockComponent( unlockCode )
Unlocks the component allowing for the full functionality to be used. If this method unexpectedly returns false, examine the contents of the LastErrorText property to determine the reason for failure. Returns true for success, false for failure.
// sigIndex is an integer (input) // mimeData is a CkByteData object (output) // Returns a boolean value VerifyDkimSignature( sigIndex, mimeData )
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 true for success, false for failure.
// sigIndex is an integer (input) // mimeData is a CkByteData object (output) // Returns a boolean value VerifyDomainKeySignature( sigIndex, mimeData )
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 true for success, false for failure.
// Returns a string dkimAlg( )
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". Returns a null on failure
// Returns a string dkimCanon( )
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". Returns a null on failure
// Returns a string dkimDomain( )
The domain name of the signing domain when creating the DKIM-Signature. Returns a null on failure
// Returns a string dkimHeaders( )
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". Returns a null on failure
// Returns a string dkimSelector( )
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". Returns a null on failure
// Returns a string domainKeyAlg( )
The signing algorithm to be used in creating the DomainKey-Signature. The only possible value is "rsa-sha1". The default value is "rsa-sha1". Returns a null on failure
// Returns a string domainKeyCanon( )
Canonicalization algorithm to be used for when creating the DomainKey-Signature. Possible values are "simple" and "nofws". The default value is "nofws". Returns a null on failure
// Returns a string domainKeyDomain( )
The domain name of the signing domain when creating the DomainKey-Signature. Returns a null on failure
// Returns a string domainKeyHeaders( )
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". Returns a null on failure
// Returns a string domainKeySelector( )
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". Returns a null on failure
// Returns a string lastErrorHtml( )
Error information in HTML format for the last method called.Returns a null on failure
// Returns a string lastErrorText( )
Error information in plain-text format for the last method called.Returns a null on failure
// Returns a string lastErrorXml( )
Error information in XML format for the last method called.Returns a null on failure
|