CodeSign Tcl Reference Documentation

CodeSign

Current Version: 10.1.2

A class for signing Windows executables and DLLs, and for verifying signed executables and DLLs. This is a Windows-only class. The class and functions will exist on non-Windows systems, but will be no-op functions (stubs) that simply return a failed status.

Object Creation

set myCodeSign [new CkCodeSign]

Properties

DebugLogFilePath
string
# ckStr is a CkString
CkCodeSign_get_DebugLogFilePath $myCodeSign $ckStr
set strVal [CkCodeSign_get_debugLogFilePath $myCodeSign]
CkCodeSign_put_DebugLogFilePath $myCodeSign $strVal

If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.

Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.

Possible causes of hangs include:

  • A timeout property set to 0, indicating an infinite timeout.
  • A hang occurring within an event callback in the application code.
  • An internal bug in the Chilkat code causing the hang.

More Information and Examples
top
LastErrorHtml
string
# ckStr is a CkString
CkCodeSign_get_LastErrorHtml $myCodeSign $ckStr
set strVal [CkCodeSign_get_lastErrorHtml $myCodeSign]

Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorText
string
# ckStr is a CkString
CkCodeSign_get_LastErrorText $myCodeSign $ckStr
set strVal [CkCodeSign_get_lastErrorText $myCodeSign]

Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorXml
string
# ckStr is a CkString
CkCodeSign_get_LastErrorXml $myCodeSign $ckStr
set strVal [CkCodeSign_get_lastErrorXml $myCodeSign]

Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastMethodSuccess
boolean 1/0
set boolVal [CkCodeSign_get_LastMethodSuccess $myCodeSign]
CkCodeSign_put_LastMethodSuccess $myCodeSign $boolVal

Indicates the success or failure of the most recent method call: 1 means success, 0 means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages.

top
UncommonOptions
string
# ckStr is a CkString
CkCodeSign_get_UncommonOptions $myCodeSign $ckStr
set strVal [CkCodeSign_get_uncommonOptions $myCodeSign]
CkCodeSign_put_UncommonOptions $myCodeSign $strVal
Introduced in version 9.5.0.97

This is a catch-all property to be used for uncommon needs. This property defaults to the empty string and should typically remain empty.

Can be set to a list of the following comma separated keywords:

  • "codesign-allow-expired-cert" - Don't fail authenticode signature validation because the signing certificate is expired.

top
Utf8
boolean 1/0
set boolVal [CkCodeSign_get_Utf8 $myCodeSign]
CkCodeSign_put_Utf8 $myCodeSign $boolVal

When set to 1, all "const char *" arguments are interpreted as utf-8 strings. If set to 0 (the default), then "const char *" arguments are interpreted as ANSI strings. Also, when set to 1, and Chilkat method returning a "const char *" is returning the utf-8 representation. If set to 0, all "const char *" return values are ANSI strings.

top
VerboseLogging
boolean 1/0
set boolVal [CkCodeSign_get_VerboseLogging $myCodeSign]
CkCodeSign_put_VerboseLogging $myCodeSign $boolVal

If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
string
# ckStr is a CkString
CkCodeSign_get_Version $myCodeSign $ckStr
set strVal [CkCodeSign_get_version $myCodeSign]

Version of the component/library, such as "10.1.0"

More Information and Examples
top

Methods

AddSignature
# path is a string
# cert is a CkCert
# options is a CkJsonObject
set status [CkCodeSign_AddSignature $path $cert $options]
Introduced in version 9.5.0.97

Authenticode signs a DLL or EXE.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AddSignatureAsync (1)
# returns a CkTask
# path is a string
# cert is a CkCert
# options is a CkJsonObject
set ret_task [CkCodeSign_AddSignatureAsync $path $cert $options]
Introduced in version 9.5.0.97

Creates an asynchronous task to call the AddSignature method with the arguments provided.

Returns NULL on failure

top
GetSignerCert
# cert is a CkCert
set status [CkCodeSign_GetSignerCert $cert]
Introduced in version 10.0.1

This method retrieves the signer certificate after calling VerifySignature. If successful and the signer certificate is fully available, cert will contain the certificate.

Returns 1 for success, 0 for failure.

top
RemoveSignature
# path is a string
set status [CkCodeSign_RemoveSignature $path]
Introduced in version 9.5.0.97

Removes the authenticode signature of a Windows executable or DLL. The path to the executable/DLL is passed in path.

Returns 1 for success, 0 for failure.

top
VerifySignature
# path is a string
# sigInfo is a CkJsonObject
set status [CkCodeSign_VerifySignature $path $sigInfo]
Introduced in version 9.5.0.97

Verifies the signature of a Windows executable or DLL. The path to the executable/DLL is passed in path. Information about the signature is returned in sigInfo. Returns 1 if the signature is verified indicating the EXE or DLL can be trusted. Otherwise returns 0.

Returns 1 for success, 0 for failure.

More Information and Examples
top