Encr_Code (function reference)

By February 1, 2019 February 12th, 2019 Online Help, Troi Encryptor Plug-in
Troi Encryptor Plug-in for FileMaker Pro

Encr_Code

Performs an encryption or decryption of the data field, depending on switches.

SyntaxFunction badge

Encr_Code ( switches ; password ; data )

Parameters

switchesspecify what (de)coding action to perform
passwordthe password to use
datathe text (or container) to perform the action on

Switches

Switches can be:

-EncryptDESencrypt using the newDES algorithm (and the password)
-DecryptDESdecrypt using the newDES algorithm (and the password)
-EncryptRijndaelAESencrypt using the (more secure) AES algorithm (and the password)
-DecryptRijndaelAESdecrypt using the (more secure) AES algorithm (and the password)
-DecodeSafeAsciiDecryptDESDecompressfirst decode from SafeAscii, then decryptDES and then decompress

for AES encryption you can also add one or more of these switches to retrieve extra information:

-AddIntializationVectorInfoadd the used Intialization Vector at the end of the result (need not be kept secret)
-AddSaltInfoadd the used Salt at the end of the result (need not be kept secret)
-AddKeyInfoadd the derived Key (derived from the password) at the end of the result (keep secret!)
-OpenSSLCompatibleformat as OpenSSL compatible result
-HashIterationCount=xspecify the hash iteration count used to generate the key and IV (for OpenSSL)

Other switches are not (yet) possible.

Returned Result

Data type returned

Text

Result

the coded text. This can be encrypted text or decrypted text.

Originated in

Troi Encryptor Plug-in 1.5

Compatibility

FileMaker Pro 14 to 17

Considerations

– You can use this function to encrypt and decrypt without a script.
– For good security make sure the password is at least 8 characters long. Also be aware that the password is case sensitive.
– (Rijndael) AES is a more secure algorithm than NewDES.
See Encr_EncryptAES for more technical information on the AES implementation.
– New in v2.5.2: the switch “-DecodeSafeAsciiDecryptDESDecompress”. This will perform three actions in succession: first decode from SafeAscii, then decrypt the intermediate result (using decryptDES) and finally decompress it.

About OpenSSL compatibility (introduced with Troi Encryptor 5.0):

See the Encr_EncryptAES and Encr_DecryptAES function for more information.

Example

Set Field [ secretField ;   
		Encr_Code ( "-EncryptDES" ;  gEncryptionPassword ; textField ) ]
Set Field [ result ;   
		Encr_Code ( "-DecryptDES" ;  gDecryptionPassword ;  secretField ) ]

gDecryptionPassword = a global text field where the user can type in the password that will be used to generate a key for the encryption or decryption.

Example 2

Set Field [ secretField ;   
		Encr_Code ( "-EncryptRijndaelAES -AddSaltInfo" ;  
		gEncryptionPassword ; textField ) ]

this will result in:

<TROI_AES_STD_ENCR10>
NVFJPSV9fX19fX19fX19fbkO656mTvKWiWbKQqul7R5tZd7+aQ3h0QaLQOO6EUtFjxDLRxNQp
rwFN1JhuE5SNPaSBWbCrteX7uPmqKpdyFrmcGwqX7CjZ5cE/ISIwD6LWh3hguv1JObZqj7+n
fWhvu4AflFM765T8hlg6BbeHjI2oUwGz
</TROI_AES_STD_ENCR10>

<TROI_SALT>43bae7a993bca5a259b290aae97b479b5977bf9a</TROI_SALT>

Related functionsFunction badge

Encr_DecryptAES
Encr_DecryptNewDES
Encr_EncodeSafeAscii
Encr_EncryptAES
Encr_EncryptNewDES

Related topics

Troi Encryptor Plug-in online help (overview)


Online Help Page for Troi Encryptor Plug-in for 14 to 17 –> Encr_Code (encrp4221) 2019-0212 17:55:34