Encr_Code (function reference)

By February 1, 2019June 10th, 2020Online 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

switches specify what (de)coding action to perform
password the password to use
data the text (or container) to perform the action on

Switches

Switches can be:

-EncryptDES encrypt using the newDES algorithm (and the password)
-DecryptDES decrypt using the newDES algorithm (and the password)
-EncryptRijndaelAES encrypt using the (more secure) AES algorithm (and the password)
-DecryptRijndaelAES decrypt using the (more secure) AES algorithm (and the password)
-DecodeSafeAsciiDecryptDESDecompress first 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:

-AddIntializationVectorInfo add the used Intialization Vector at the end of the result (need not be kept secret)
-AddSaltInfo add the used Salt at the end of the result (need not be kept secret)
-AddKeyInfo add the derived Key (derived from the password) at the end of the result (keep secret!)
-OpenSSLCompatible format as OpenSSL compatible result
-HashIterationCount=x specify 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 15 to 19

Considerations

– You can use this function to encrypt and decrypt without a script.
– For good security make sure the password is at least 10 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 15 to 19 –> Encr_Code (encrp4221) 2020-0610 16:18:59