Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

DecryptData

  • Last UpdatedOct 29, 2026
  • 2 minute read

DecryptData decrypts a string of data using a specified key.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

DecryptData

String

Synchronous

Yes

Supported (see notes)

Supported (see notes)

Supported

Supported

Executed on Server

Syntax

DecryptData(strEncryptedData,strKey)

strEncryptedData

The encrypted data to be decrypted, provided as a string value. It is limited to 1024 characters and needs to be properly encoded in Base64.

strKey

The key to be used to decrypt the encrypted data. It must be the same key that was originally used to encrypt the data. This parameter can be optional if called on a Windows runtime; see Notes below for more details.

Return value

If this function succeeds, it returns the decrypted data as a plaintext string. See Notes below for additional information.

Notes

This function is typically used to decrypt data that was encrypted by the EncryptData function, but it can be used to decrypt other data, as long as that data was encrypted using the same algorithm and then saved as an encoded string.

The EncryptData and DecryptData functions use 128-bit AES encryption. Ask a cybersecurity expert whether this type of encryption meets your needs. Do not share your keys with unauthorized personnel, and be careful about where and how you store your keys.

On a Windows runtime (including Windows Embedded) with Windows Data Protection enabled, if this function is called from a Background Task without supplying the second parameter (strKey), the string supplied by strEncryptedData will be decrypted using the Windows Data Protection key. If Windows Data Protection is not enabled and strKey is omitted, this function will fail and return the BAD quality.

In any other scenario, this function will fail if strKey is omitted. These scenarios include calling this function on a Windows runtime from anything other than a Background Task, calling this function on a Linux runtime (using either IoT View or Viewer), or calling it from Mobile Access (on Windows or Linux runtime).

Examples

Decrypt the value of a tag using a specified key:

DecryptData(MyEncryptedData,"V4rM#ydar6T^rZn")

Decrypt the value of a tag using a key stored in another tag:

DecryptData(MyEncryptedData,MyKey)

Decrypt the value of a tag encrypted by EncryptData on the same Windows runtime with Windows Data Protection enabled (called from a Background task only):

DecryptData(MyEncryptedData)

In This Topic
Related Links