Skip to main content

TrFile_GetCodeSignInfo (function reference)

Troi File Plug-in > Functions reference > TrFile_GetCodeSignInfo
Troi File Plug-in for FileMaker Pro


Gets code sign information of a (application) file or checks if the signing is valid

SyntaxFunction badge

TrFile_GetCodeSignInfo ( switches ; filePath )


switches modifies the behavior of the function
filePath the path to the (application) file to be checked


Switches can be empty or one of this:

-GetGeneralInfo (default) returns a list of general information of the certificate used to sign the file
-HasValidCodeSign returns 1 if this file has a valid code sign and 0 (zero) otherwise
-GetSubjectName returns the subject name of the certificate (like the company or organization)
-GetPublicKey returns the public key

Returned Result

Data type returned



The returned result depends on the switch used. See above and the examples below.

If an error occurs it will start with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

$$-43 fnfErr the file could not be found
$$-120 dirNFErr directory not found

Other errors may be returned.

Originated in

Troi File Plug-in 10.0


FileMaker Pro 16 to FileMaker Pro 2023


TrFile_GetCodeSignInfo ( "-HasValidCodeSign" ; 
		"C:\Program Files\FileMaker\FileMaker Pro 16 Advanced\FileMaker Pro Advanced.exe" )

This will return 1 if the executable is valid, 0 if it has an invalid signing. The result can also be an error code, starting with $$.

Example 2

We assume that in your FileMaker file the following fields are defined:

  gErrorCode		Global, number
  gSourceFilePath	Global, text
  gCodeSignInfo		Global, text

gSourceFilePath should contain the path to an existing file, for example “D:\Acme_Plugin.fmx64” (Windows) or “Mac HD:Acme.fmplugin” (Mac). In a script add the following script steps:

Set Variable [ $FilePath ; gSourceFilePath  // store the path in a variable ]
Set Variable [ $Result ; TrFile_GetCodeSignInfo ( "-GetGeneralInfo" ; $FilePath ) ]
If [ Left ( $Result ; 2 ) = "$$" // there is an error ]
	Set Variable [ $ErrorCode ; $Result ]
	Set Field [ gCodeSignInfo ; "" // clear ]
	Set Field [ gCodeSignInfo ; $Result ]
End If

This will put the code sign info into the field, and will be similar to this:

Name: Acme Software Corp.
Issued by: Apple Certification Authority
Sign status: Signed with a valid certificate

If the code signing is incorrect the result will be:

Sign status: Invalid, incorrectly signed.

If the file is not signed at all the result will be:

Sign status: Not signed, no code signing information found.

Used in example file


Related functionsFunction badge


Related script stepsScript step badge

Delete file
Launch Application

Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 16 to 2023 –> TrFile_GetCodeSignInfo (filep4318) 2023-0601 15:22:29