Encr_Code (function reference)

By August 1, 2017 September 26th, 2017 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 Rijndael 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!)

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 12 to 16

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_EncryptRijndaelAES 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.

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_DecryptNewDES
Encr_DecryptRijndaelAES
Encr_EncodeSafeAscii
Encr_EncryptNewDES
Encr_EncryptRijndaelAES

Related topics

Troi Encryptor Plug-in online help (overview)


Online Help Page for Troi Encryptor Plug-in for 12 to 16 –> Encr_Code (encrp4221) 2017-0814 18:07:41