Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Encryption.EncryptAES

Encrypts data with with AES engine in CBC mode.

Component Version macOS Windows Linux Server iOS SDK
Encryption 2.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes

Deprecated

This function was deprecated. Use Encryption.Cipher instead.

MBS( "Encryption.EncryptAES"; Key; Text { ; iv } )   More

Parameters

Parameter Description Example Flags
Key The key you want to use. "Hello"
Text The text to encrypt. "Hello World"
iv The initial vector as a text with up to 16 bytes length. "1234567890ABCDEF" Optional

Result

Returns encrypted text encoded as hex.

Description

Encrypts data with with AES engine in CBC mode.
This function uses UTF-8 for key, text and iv parameters.
Keys shorter than 128 bit, 192 bit or 256 bit length are padded with null bytes to right size. This means that only the first 32 characters are used at most.

Deprecated. Please move to Encryption.Cipher for new projects.

Examples

Simply encrypt a text:

MBS( "Encryption.EncryptAES"; $key; $text )

Trying to reproduce Encryption.EncryptAES with Encryption.Cipher:

# So, let's try a test case:

Set Variable [ $r1; Value: MBS( "Encryption.EncryptAES"; "Hello World"; "Hello World")]
# 514532926253C04A15302CF85BD7C816

# And sicken AES adds zeros to fill blocks, we have to use hex mode here:
Set Variable [ $r2; Value: MBS( "Encryption.Cipher"; "encrypt"; "AES-128-CBC";
"Hex"; HexEncode("Hello World") ; "";
"Hex"; HexEncode("Hello World") & "0000000000"; "";
"Hex"; "";
""; ""; ""; 0 ) ]
# Gives
# 514532926253C04A15302CF85BD7C8168E6AE36F6FB574F32FEA6932A5E0595F
#
# Which looks like it uses two blocks instead of one above.

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 25th February 2026


Encryption.DigestNames - Encryption.EncryptBlowfish