Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
11.3
11.4
Statistic
FMM
Blog
Encrypts or decrypts of a value.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Encryption | 4.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
Direction | Whether to encrypt or decrypt. Pass encrypt or decrypt. | "encrypt" | |
Algorithm | Which algorithm to use. Can be for example RC2, blowfish, AES128, AES192, AES256. | "AES-128-CFB" | |
KeyType | The type of input for key. Can be Text, Container, Image, Path, PDF, Data, base64 or Hex. |
"Text" | |
KeyData | The actual input data for the key. Text, container or file path. Must not be longer than the maximum key length of the given algorithm. If key is too short, we pad it with zero bytes. If the key is text, please check what type of line ending you use and whether to trim the key. |
"Hello World" | |
KeyEncoding | The text encoding for text input. Parameter is ignored for other cases. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF-8" | |
InputType | The type of input. Can be Text, Container, Image, Path, PDF, Data, base64 or Hex. |
"Text" | |
InputData | The actual input data. Text, container or file path. |
"Hello World" | |
InputEncoding | The text encoding for text input. Parameter is ignored for other cases. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF-8" | |
OutputType | The output type. Can be Base64, Hex, Text, File, Path. Can be Auto in plugin version 7.3 to detect type for container from OutputInfo parameter. Added Base64URL as option for plugin version 10.3. |
"Hex" | |
OutputInfo | The addition info for output. For text it is the text encoding, for file container the file name and for path the actual native file path. |
"" | Optional |
IVType | The type of input. Can be Text, Container, Image, Path, PDF, Data, base64 or Hex. In version 6.0 and newer you can pass Input here to take IV from input data. |
"Text" | Optional |
IVData | The actual input data for the IV. Text, container or file path. Must not be longer than the maximum IV length of the given algorithm. If IV is too short, we pad it with zero bytes. |
"Hello World" | Optional |
IVEncoding | The text encoding for text input. Parameter is ignored for other cases. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF-8" | Optional |
Padding | Whether to use padding. Pass 1 to enable padding (default). Pass 0 to disable. |
0 | Optional |
Returns encrypted/decrypted value or text.
Encrypts some text with AES:
MBS( "Encryption.Cipher"; "encrypt"; "AES-128-CFB"; "Text"; "Test Key 1234567"; "UTF-8"; "Text"; "Hello World"; "UTF-8"; "Hex"; "" )
Example result: CFD7F09EEC76A23CF489C9
Encrypts a container:
MBS( "Encryption.Cipher"; "encrypt"; "AES-256-ECB"; "Hex"; "1234567812345678123456781234567812345678123456781234567812345678"; ""; "Container"; MyTable::MyContainer; ""; "Hex"; "" )
Encrypt and decrypt:
# encrypt something
$r = MBS("Encryption.Cipher"; "encrypt"; "AES-128-CFB"; "Text"; "Secret"; "UTF-8"; "Text"; "Input Text"; "UTF-8"; "Hex"; "" )
# returns "C577EC9EBE28B1F4E1FD"
# and backward
$r = MBS("Encryption.Cipher"; "decrypt"; "AES-128-CFB"; "Text"; "Secret"; "UTF-8"; "Hex"; "C577EC9EBE28B1F4E1FD"; ""; "Text"; "UTF-8" )
Encrypt with AES 256bit Counter (CTR) mode:
# Make a 256 bit key with a hash
Set Variable [$hash; Value:MBS( "Hash.Digest"; "SHA256"; "Text"; "My Secret Password"; "UTF-8"; "Hex" )]
# now encrypt some text
Set Variable [$encrypted; Value:MBS( "Encryption.Cipher"; "encrypt"; "AES-256-CTR"; "Hex"; $hash; ""; "Text"; "Hello World"; "UTF-8"; "Hex"; "" )]
# and show encrypted text
Show Custom Dialog [$encrypted]
Encrypt Umsatzzähler für Registrierkasse mit AES ICM/CTR:
MBS( "Encryption.Cipher"; "encrypt"; "AES-128-CTR"; "TEXT"; $Schlüssel; "UTF-8"; "Hex"; $KodierterUmsatzzählers; ""; "Hex"; ""; "Text"; $Kassenidentifikationsnummer & $Belegnummer; "UTF-8" )
Decrypt Blowfish ECB:
MBS( "Encryption.Cipher"; "decrypt"; "bf-ecb"; "TEXT"; "strunzhasensalat"; "UTF-8"; "base64"; "TkfrFBRE0pkp3lzEX7YibCVnz+S79ckp"; ""; "Text"; "UTF-8" )
Created 18th August 2014, last changed 22nd May 2020
EmailParser.WriteInline - Encryption.CipherNames
Feedback: Report problem or ask question.