snmpcrypt_encryptAccessParameter()
The function allows to encrypt SNMP access parameters with the defined password of the corresponding driver ID.
Synopsis
int snmpcrypt_encryptAccessParameter(int drvNum, string
accessParam);
Parameters
Parameter | Description |
---|---|
drvNum | Number of the driver for which the access parameters shall be encrypted |
accessParam | SNMP access parameter (e.g. Read Community) that shall be encrypted |
Return value
The function returns the passed access parameter as encrypted string. If no passphrase is defined for the driver ID the access parameter is returned as clear text.
Errors
Possible errors are:
-
Wrong function parameters
-
Wrong pass phrase
Description
The function allows to encrypt the SNMP access parameter of a specific driver ID with a defined password (see snmpcrypt_setAccessPassPhrase()). If no password is defined for the driver ID the function can still be used but only an unencrypted access parameter is returned.
To use this function the CTRL library snmpCrypt must be added to the script by adding “#uses "snmpCrypt"” at the top of the script.
Example
Following example encrypts the access parameter "Private" of the driver with ID 2.
#uses "snmpCrypt"
encrypt()
{
string accessParamEncr;
int drvNum = 2;
string accessParamPlain = "Private";
accessParamEncr = snmpcrypt_encryptAccessParameter(drvNum,
accessParamPlain);
DebugN("Encrypted SNMP Access Parameter for Driver ID 2",
accessParamEncr);
}
Assignment
SNMP
Availability
CTRL