aes256Decrypt()
The function allows to decrypt an encrypted information with the AES-256 algorithm.
Synopsis
int aes256Encrypt(blob src, string key, string|blob &dest);
Parameter
Parameter | Description |
---|---|
src | Value that should be decrypted |
key | Key used for the encryption |
dest | Decrypted return value |
Return Value
The function returns -1 in case of missing or wrong arguments. Otherwise the number of decrypted characters.
Error
Possible errors are:
-
Wrong function parameters
Description
The function can be used to decrypt a string with the AES-256 algorithm. It is to mention that if a wrong key is used no error is raised due to the fact, that it cannot be validated if the returned value is correct.
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 AES-256 encrypted string “71A5E79063FCE80167BDABEC590496C6” is decrypted by using the key “MyKey”.
#uses "snmpCrypt"
decrypt()
{
string src = "71A5E79063FCE80167BDABEC590496C6";
string key = "MyKey";
string dest;
aes256Decrypt((blob)src, key, dest);
DebugN("decrypted text", dest);
}
Assignment
SNMP
Availability
CTRL