Pages

Tuesday, November 13, 2012

Quick Test Professional (QTP) - Crypt Object


This object encrypts strings in a format that the QTP SetSecure function understands. Encrypt is the only method provided by the object.

'Encrypt the string
myVar = Crypt.Encrypt("QTPText")

The above statement will assign myVar a value which looks something like
"456955244855c54535454f5455784456f66446s7r464a64r64kj464b6467h443g3234"

This value produced by Crypt.Encrypt is not constant because encrypting the same string again generates a different encrypting string. Now the question arises that when should this capability be used? Consider a script which is executed on a tester's PC with the results sent to others. Is the script has a step top enter a password:

'Set the text in the WebEdit
Browser("Browser").Page("Page").WebEdit("password").Set "QTP"

Then this step will appear in the result summary and will include the "QTP" value. This could compromise security, so let's replace the above statement with a new one:

'Encrypt and then set the password
sEncryptPassword = Crypt.Encrypt("QTP")
Browser("Browser").Page("Page").WebEdit("password").SetSecure sEncryptPassword

Now the password won't appear in the test result summary as we are using the secure mode of setting the password.

NOTE: We can also create an instance of the crypt object is VBScript using the following code :
Set myCrypt = CreateObject("Mercury.Encrypter")

1 comment:

  1. A gambling site that is scam or legit - DRMCD
    동해 출장샵 casino › japan › casino › japan 5 days ago — 5 days ago Our casino 강원도 출장마사지 review 광주 출장샵 takes a 구리 출장마사지 look at the game selection, bonuses, banking methods, payment 경기도 출장안마 methods, and customer support.

    ReplyDelete