Decrypt

Verb: decrypt

Available from: <Standard>

Decrypts data from a byte list according to the encryption you choose.

Syntax

decrypt --source(List<Byte>) --cipher(Cipher) (Boolean)=success (List<Byte>)=value

Inputs

Script Designer Required AcceptedTypes Description
--source Source Required List<Byte> List with encrypted Bytes for decryption.
--cipher Cipher Required Cipher Encryption used to decrypt the data.

Outputs

Script Designer AcceptedTypes Description
success Success Boolean True if decryption completes correctly and False if otherwise.
value Decrypted bytes List<Byte> Decrypted data.

Example

Decrypts a message using AES encryption. In the end, it reports success.

defVar --name encryptionAES --type Cipher
defVar --name encryptedMessage --type List --innertype Byte
defVar --name decryptSuccess --type Boolean
defVar --name bytesDecrypted --type List --innertype Byte
defVar --name decryptedMessage --type String
//Create an AES encryption.
cipherAes --key hsjkdlksjhjkjhgh --iv klsoikjdhyfukjsh encryptionAES=value
//Encrypt the message.
encrypt --source "Hello World" --cipher ${encryptionAES} encryptedMessage=value
//Decrypts the bytes of the message contained in ${encryptedMessage} and saves in ${bytesDecrypted}.
decrypt --source ${encryptedMessage} --cipher ${encryptionAES} bytesDecrypted=value decryptSuccess=success
logMessage --message "${decryptSuccess}" --type "Info"
logMessage --message "${bytesDecrypted}" --type "Info"
//Converts the decrypted bytes to text.
bytesToText --bytes ${bytesDecrypted} --convertiontype "Text" --encoding "Default" decryptedMessage=value
logMessage --message "${decryptedMessage}" --type "Info"
//Execution returns the following outputs:
//true
//[72,101,108,108,111,32,87,111,114,108,100]
//Hello World

Remarks

In the Cipher parameter, the same encryption type used to encrypt the data must be used.

See Also

  • Create AES Encryption
  • Create Blowfish Cipher
  • Create RC2 Encryption
  • Create Rijndael Cipher
  • Create RSA Cipher
  • Encrypt