Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter SixteenApplication (continued)

GetEncryptedSetting Function

Overview

The GetEncryptedSetting function retrieves a single line item as a string from a Windows-style INI file. Unlike GetSetting, the value can be encrypted and decrypted using a supplied or default key.

Syntax/Parameters

Syntax

string = GetEncryptedSetting ( [string fnTarget], string section,
                                              string
entry, string key );

Parameters

fnTarget

An optional string defining the target file containing the settings. If the parameter is omitted (i.e., there are only two string parameters provided to the function), the target name will be the name of the script plus an ini script. For example, if the script name is “Production Interface.ls”, the target will default to “Production Interface.ini”. If the string is supplied but is empty, the default application workstation settings file is used for the target. If a filename is provided without a path, the file is referenced from the application data folder (%appdata%).

section

A string specifying the section (also known as the application name) in which the entries are grouped. This name is contained within brackets inside the target file. Every entry must belong to a section.

entry

A string specifying the entry name (also known as the key name) identifying the data. The entry identifies the line item within the section. For example, the line entry within a section, ‘My Key=Some Data”, the ‘My Data’ field is the entry or key name and ‘Some Data’ is the data associated with the key.

key

A string or char array to use as the encryption key. If used as a string, the key size is determined by the first zero terminating byte. For a character array, the size of the character array is used as the key size. A key that is not exactly 128, 192, 256 bits (16, 24 and 32 bytes respectively) will be zero padding to the appropriate number of bits. A key exceeding 256 bits will be truncated. The parameter must be specified setting it to an empty string will use the Legato default key. [See Legato Keys and Code Signing]

Return Value

A string specifying the data associated with the target, section and entry. If the string is empty, it may indicate an error or an empty entry. Use the GetLastError function to determine if the string was empty or there was an error.

Remarks

If the target is located in the user’s roaming data area, it will be private to that user and possibly available on other workstations the user logged into (provided roaming profiles are enabled).

If the data is not encrypted, the function falls back to the behavior of GetSetting and adds TRUE to the last error buffer. This option allows external programs to add data that can be later encrypted. If the script does not wish to allow unencrypted data, check the last error and then fail if the value is non-zero.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic