aes256Encrypt()

The function allows to encrypt the passed information with the AES-256 algorithm.

Synopsis

int aes256Encrypt(string|blob src, string key, blob &dest);

Parameter

Parameter Description
src Value that should be encrypted
key Key used for the encryption
dest Encrypted return value

Return Value

The function returns -1 in case of missing or wrong arguments. Otherwise the length of the resulting blob in byte is returned.

Error

Possible errors are:

  • Wrong function parameters

Description

The function can be used to encrypt a string or blob with the AES-256 algorithm

To use this function the CTRL library CtrlCrypt must be added to the script by adding “#uses “CtrlCrypt” at the top of the script.

Example

The string “MyPassword” is encrypted with the AES-256 algorithm. The encryption key “MyKey” is used

#uses "snmpCrypt"
encrypt()
{
  string src = "MyPassword";
  string key = "MyKey";
  blob dest;
  aes256Encrypt(src, key, dest);
  DebugN("Encrypted Text", (string)dest);
}

Assignment

SNMP

Availability

CTRL