Encr_AES_DecryptUsingKey (function reference)

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


Decrypts data with AES using an encryption key and initialization vector.

SyntaxFunction badge

Encr_AES_DecryptUsingKey ( switches ; key ; initializationVector;
                           dataToDecrypt ; {paddingScheme} )


switchesmodifies the behavior of the function
keythe key to use
initializationVectorthe initialization vector (IV) to use (formatted in Base64)
dataToDecryptthe text to decrypt
paddingScheme(optional) the padding that was used, can be: PKCS7 (default) or ZeroPadding


You can add one or more of these switches to retrieve extra information:

-AddSaltInfoadd the used Salt at the end of the result (need not be kept secret)

Other switches are not (yet) possible.

Returned Result

Data type returned



the decrypted text or an error code.

Returned error codes can be:

$$-4244kErrPwdEmptyno decryption key was given
$$-50paramErrParameter error (incorrect key size or IV size given)

Originated in

Troi Encryptor Plug-in 3.0


FileMaker Pro 14 to 17


This is an advanced function, for exchanging data with other systems. You might want to use the more simple Encr_DecryptAES function.

You use this in conjunction with the Encr_AES_CreateKeyAndIV function (and to encrypt the Encr_AES_EncryptUsingKey function).

Technical details:
AES-128: 128 bit, CBC with a 16 byte key. Blocksize is 16 byte so the IV is 16 byte.
AES-256: 256 bit, CBC with a 32 byte key. Blocksize is also 16 byte so the IV is 16 byte.


Use the result of the Encr_AES_CreateKeyAndIV function to fill the following variables:

Set Variable [ $EncryptionKey ; "ZTBkMDczYzdkN2NhZDNiMjFmMDM1MTdiOWMwM2Q3ZDg=" ] 
Set Variable [ $InitializationVector ; "eYylMTRugzqcaHrqW7JxQg==" ]

Also set the following variables:

Set Variable [ $OriginalText ; "9/0bnrlHqOTojVF2qrmrRw== " ] 
Set Variable [ $PaddingScheme ; "PKCS7" ]

Then decrypt it:

Set Variable [ $DecryptedText ; Encr_AES_DecryptUsingKey ( "-unused" ; $EncryptionKey ; 
			$InitializationVector ; $OriginalText ; $PaddingScheme ) ]

The result will be the original data, for example:
“your text to be made secret”

If the key or iv is different from the encryption the result will be random data.

Related functionsFunction badge


Related topics

Troi Encryptor Plug-in online help (overview)

Online Help Page for Troi Encryptor Plug-in for 14 to 17 –> Encr_AES_DecryptUsingKey (encrp4321) 2019-0212 17:59:16