# Troi Encryptor Plug-in FMP6 conversion notes

We have two current encryption plug-ins: Troi Coding Plug-in 1.6.2 which uses the Classic API and Troi Encryptor Plug-in 2.5.2 (or higher) which uses the newer FileMaker 7 Native syntax (API). The Troi Encryptor Plug-in is the new name for the Troi Coding Plug-in, and is upwards compatible with the Troi Coding Plug-in. Troi Encryptor Plug-in has the same functions (and more) as Troi Coding Plug-in, in the FileMaker 7 format. Below you find a discussion of both plug-ins. NOTE The function API is the same for FileMaker Pro 9, 8.5 and FileMaker Pro 7. NOTE 2 Below we will discuss Troi Encryptor Plug-in 2.0, the first version to use the new FileMaker 7 API, but this also applies to future versions with a higher number, like version 2.5.2 TIP Although you can use both Troi Coding Plug-in 1.6.2 and Troi Encryptor Plug-in 2.0 together when running FileMaker 7, this is not recommended. Please only use Troi Encryptor Plug-in 2.x for FileMaker Pro 7, as FileMaker Pro 7 does not always work correctly with the Troi Coding plug-in 1.6.2. ## Troi Coding Plug-in 1.6.2 (Classic API) is not completely compatible with FileMaker 7/8 Troi Coding Plug-in 1.6.2 in general does work with FileMaker Pro 7. However we have found these specific issues with FileMaker 7: ### Zeros in (encrypted) fields If there are ASCII zeros in a text FileMaker does only give the text before the ASCII zero to the plug-in. TIn some cases this can result in data loss. Please use Troi Encryptor Plug-in. ### Omega and Apple characters in (encrypted) fields. The Omega character "Ω", with Mac ASCII code 189 (0xBD), is in FileMaker Pro 7 converted to Unicode 937. However on Windows UNICODE 8486 is used (0x2126). The Apple character "", with Mac ASCII code 240 (0xF0), is in FileMaker Pro 7 converted to Unicode 63743. However on Windows this is not returned at all. This is a problem. This can result in data loss. Please use Troi Encryptor Plug-in. ### General issue for all classic plug-ins with higher ASCII's FileMaker Pro 7 has a new internal architecture, which is using Unicode for the text fields. FileMaker Pro 6 only used ASCII encoding. All plug-ins written for the 'classic' FileMaker 6 architecture do not receive characters that are outside this ASCII range, these characters are replaced with spaces. In general our classic plug-ins should be compatible as long as the text used is lower ASCII text. Troi Coding Plug-in 1.6.2 is using the classic API, so only characters in the ASCII range will work. ## Troi Encryptor Plug-in 2.0 (Native FileMaker 7 API) Troi Encryptor Plug-in 2.0 was created specifically for FileMaker Pro 7. Below are some considerations when converting to Troi Encryptor Plug-in 2.0. ### New function syntax The plug-in functions have a different syntax compared to the FileMaker 6 plug-in. For example the Checksum function has this syntax in the classic API: `External("Troi-Checksum", "text" )` The syntax in the new API looks like this: `Encr_Checksum( switches ; text )` Note that functions look like a real function call, no longer a call to External(). Also a hyphen "-" is no longer allowed, so the hyphens have changed to underscores "_" instead. Note too that parameters don't have to be concatenated with a pipe. Instead use a semicolon ";" to separate the parameters. The brackets "{}" indicate optional parameters. Below is an example how this function would appear in ScriptMaker: `Set Field [ChecksumField , Encr_Checksum( "-Unused" ; "Hello World" ) ]` TIP Function names are no longer case sensitive, and will change to the correct case after you close the "Specify Calculation" dialog box. ### Multiple parameters and new switches As seen from the syntax, plug-in functions now can have multiple parameters. To make this plug-in more consistent, all functions now have a switches parameter as the first parameter. This makes enhancing the plug-in in the future easier. Finally we renamed a few functions and also removed any spaces in the name. See the specific functions notes below for the specifics. TIP Switches are not case sensitive. #### Omitting optional parameters When you omit an optional parameter be sure to add an extra semicolon after the last one, otherwise FileMaker will show an alert that there are too few parameters in this function. For example, below we omitted the 3rd parameter at the end (initialfolder). This is the correct way to do this: `Set Field [ EncryptedField, Encr_EncryptRijndaelAES("-Unused" ; password ; text ;)]` ### New parameter limits The plug-in functions now have a size limit of 1 Gb per parameter (up from the total of 64000 character limit for all parameters in FileMaker 6). The Troi Encryptor Plug-in 2.0 can handle those bigger parameters, however, displaying the results in FileMaker 7 can take a long time. For example we tested with a 300.000 character text. The step itself took less than 2 seconds. However, FileMaker then updated the layout, which took about 20 seconds! ### Converting the function call When converting FileMaker does not change the plug-in call. So after conversion you need to do this manually. Here are the global steps: remove the `External("` at the beginning in the function name: change `Troi-` to `Encr_` and remove spaces, add a `(` at the end. change the name of the function (in some cases) add as first parameter: `"-Unused"` (if no switch parameter is there) split the remaining parameters: separate each with a `;` Let's for example take this Troi Coding Plug-in 1.6.2 call: `External("Troi-Encrypt", textField )` This needs to be changed to this Encryptor Plug-in 2.0 call: `Encr_Encrypt( "-Unused" ; textField )` TIP Just copy script or steps from the example files of the Encryptor download, they are all in the Encryptor Plug-in 2.0 format! ### Renamed functions The table below will help you figure out the new names for changed function names:
Old function name | New function name | Notes
Troi-Decrypt | Encr_DecryptNewDES | added explicit NewDES to function name
Troi-Encrypt | Encr_EncryptNewDES | added explicit NewDES to function name
Troi-Set Crypt Key | Encr_SetCryptKey | removed spaces from function name
### Specific functions notes The table below lists conversion issues with specific functions:
Function name | Notes
Encr_Compress | The current implementation copies parameter and result into memory. For larger parameters this may result in overhead and out of memory errors. This applies for parameters bigger than 100 Mb.
Encr_Decompress | The current implementation copies parameter and result into memory. For larger parameters this may result in overhead and out of memory errors. This applies for parameters bigger than 100 Mb.
### Please report problems and bugs If you find any other problems or bugs, not mentioned above, please send an email to: info@troi.com. Please do NOT send attachments unless specifically requested. Please include the FileMaker Pro version, your platform and operating system in your comments.