The encryption method used by these commands and functions is based on a Vigenère cypher. The strength of the encryption is in large part based on the strength of the key. Longer keys with random characters are preferred.
Keys generated by Eggplant Functional are 16 random characters in length. You can find the key on the suite's Settings tab in the Suite Text Encoding Key section.
If you use scripts across different suites, you can change the key on the Settings tab so that different suites use the same key. Note that the suite's key is used only if you don't specify a key in the command or function.
Behavior: Decodes text that was encoded using EndcodeText. To properly decode the text, the function must receive the same key that was used to encode the text.
Parameters: Text to be decoded (in quotation marks). Optional key to use for decryption (in quotation marks). If the key parameter is omitted, the function uses the suite's encoding key.
connect (host:"192.168.120.128", port:5900, password:decodeText("ITOTnmIRa","B^6)n2+Q"))
//Allows you to display the encrypted value for the SUT's password instead of the actual password
set myDB to(type:"odbc", DSN:"mySQLDB", user:"root", password:decodetext("%s_z*A?>Z"))
//Allows you to display the encrypted value for a database connection instead of the actual password
Tip: Use the DecodeText function in the Ad Hoc Do Box to easily see the decrypted string without having to alter your scripts.
Behavior: Encodes text using an encryption key.
Parameters: Text to be encoded (in quotation marks). Optional key to use for encryption (in quotation marks). If the key parameter is omitted, the function uses the suite's encoding key.
Tip: Use the EncodeText function in the Ad Hoc Do Box to easily get the encrypted string without having to alter your scripts.
Behavior: Internally decodes encoded text, like DecodeText does, and sends the resulting keystrokes to the SUT. This command lets you send information, such as passwords, that isn't readable in a script file.
Note: Eggplant Functional doesn't log or otherwise record the decoded text.
Parameters: An encoded text string. Optional key to use for encryption (in quotation marks). If the key parameter is omitted, the function uses the suite's encoding key.
TypeEncodedText "FA4gp+6RO-N>" //Sends the encoded text to the SUT
params decryptkey //Parameterizes the script to receive the decryption key via a command line call to run the script. Example decryption key: "pegasus"
assert that decryptkey is not empty with message "Check that a decryption key has been provided." //Checks that a decryption key has been provided via the command line call and throws an exception if not
Log "Typing the password now."
// Use code such as this to read an encryption key and credentials from an external file (Excel). Assumes all stored passwords have been encrypted using the same encryption key.
set infoSource to Workbook(ResourcePath("KeySaver.xlsx"))
put worksheet(infoSource, 1) into Sheet1
put worksheet(infoSource, 2) into Sheet2
put cell(Sheet1, "A1") into encryptKey // Puts the encryption key into a variable
Put random(20) into UserNum // Generates a random number, used to select one of the 20 users from the file
typetext(cell(Sheet2,"A"&UserNum)), tabKey // Types username, then tabs to next field
Put cell(Sheet2,"B"&UserNum) into MyPass // Puts the corresponding user's encrypted password into a variable
TypeEncodedText MyPass, encryptKey // Sends the unencrypted keystrokes for the password to the SUT