CodeSign Ruby Reference Documentation
CkCodeSign
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
obj = Chilkat::CkCodeSign.new()
Properties
DebugLogFilePath
# ckStr is a CkString
codeSign.get_DebugLogFilePath(ckStr);
strVal = codeSign.debugLogFilePath();
codeSign.put_DebugLogFilePath(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.
LastErrorHtml
# ckStr is a CkString
codeSign.get_LastErrorHtml(ckStr);
strVal = codeSign.lastErrorHtml();
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.
topLastErrorText
# ckStr is a CkString
codeSign.get_LastErrorText(ckStr);
strVal = codeSign.lastErrorText();
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.
LastErrorXml
# ckStr is a CkString
codeSign.get_LastErrorXml(ckStr);
strVal = codeSign.lastErrorXml();
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.
topLastMethodSuccess
boolVal = codeSign.get_LastMethodSuccess();
codeSign.put_LastMethodSuccess(boolVal);
Indicates the success or failure of the most recent method call: true means success, false 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.
topUncommonOptions
# ckStr is a CkString
codeSign.get_UncommonOptions(ckStr);
strVal = codeSign.uncommonOptions();
codeSign.put_UncommonOptions(strVal);
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.
Utf8
boolVal = codeSign.get_Utf8();
codeSign.put_Utf8(boolVal);
When set to true, all "const char *" arguments are interpreted as utf-8 strings. If set to false (the default), then "const char *" arguments are interpreted as ANSI strings. Also, when set to true, and Chilkat method returning a "const char *" is returning the utf-8 representation. If set to false, all "const char *" return values are ANSI strings.
topVerboseLogging
boolVal = codeSign.get_VerboseLogging();
codeSign.put_VerboseLogging(boolVal);
If set to true, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is false. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.
topVersion
# ckStr is a CkString
codeSign.get_Version(ckStr);
strVal = codeSign.version();
Methods
AddSignature
# cert is a CkCert
# options is a CkJsonObject
status = codeSign.AddSignature(path, cert, options);
Authenticode signs a DLL or EXE.
Returns true for success, false for failure.
AddSignatureAsync (1)
# path is a string
# cert is a CkCert
# options is a CkJsonObject
ret_task = codeSign.AddSignatureAsync(path, cert, options);
Creates an asynchronous task to call the AddSignature method with the arguments provided.
Returns nil on failure
topGetSignerCert
This method retrieves the signer certificate after calling VerifySignature. If successful and the signer certificate is fully available, cert will contain the certificate.
Returns true for success, false for failure.
topRemoveSignature
status = codeSign.RemoveSignature(path);
Removes the authenticode signature of a Windows executable or DLL. The path to the executable/DLL is passed in path.
Returns true for success, false for failure.
VerifySignature
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 true if the signature is verified indicating the EXE or DLL can be trusted. Otherwise returns false.
Returns true for success, false for failure.