Command crypto.encryptdecrypt

The command crypto.encryptdecrypt is used to encrypt or decrypt data, in a specific format using DES, 3DES, 3DESTripleLength or NEWDES and using a specific key to return an encrypted or decrypted output.

Parameters

  1. cryptotype [string]
    Algorithm to be used:
    • DES
    • 3DES
    • 3DESTripleLength
    • NEWDES
  2. key [string]
    Hexadecimal encryption key:
    • DES: 8 bytes or 16 characters
    • 3DES: 16 bytes or 32 characters
    • 3DESTripleLength: 24 bytes or 48 characters
    • NEWDES: 15 bytes or 30 characters
  3. message [string]
    Value, hexadecimal, which will be encrypted or decrypted. If the value has more than 8 bytes it must be parsed into blocks with the command string.elementat
  4. type [integer]
    • 0: Encrypt
    • 1: Decrypt
  5. variablereturn [integer]
    Variable that will store the return of the command.

Example


In the example above, the command string.tohex has been used to transform the value of the variable sAscii in hexadecimal, which is the value required for the attribute crypto.encryptdecrypt.

The first display will display the value 3031323334353637 encrypted with type NEWDES.

The second display shows the decrypted value.