Wednesday, August 17, 2011

How to Encrypt and Decrypt passwords in LoadRunner

How to Encrypt a password in LoadRunner?

Some times when you are recording an application, LoadRunner may not do the password encryption automatically. If it does, you will see lr_decrypt(“376347drjhd….”) in the password field otherwise, password is displayed as plain text.

LoadRunner provides a tool called “Password Encoder” which can be found under
Start > All Programs > HP LoadRunner > Tools
in Windows Environment

User Interface looks like this:


Fields Description:
Password: Enter the password you want to encrypt, and then click Generate.
Encoded String: Displays the encrypted password string.
Generate: Generates an encoded string after a password is entered.
Copy: Copies the encoded password string to the clipboard.
Once the password is encrypted, the screen appears as


Note: If you click on Generate again, a new encrypted string appears for the same password.
Click on Copy.

How to view Encrypted password?
You may have to view the password sometimes for some reason, and LoadRunner doesn’t provide any tool for Decrypting the password. So, How shall we view?

The simple technique is open a Web(HTTP/HTML) protocol and type the following statement into Action action and Run.

lr_log_message("%s",lr_decrypt("4e4b0e8ff417f9f9fd06a341ec1a"));

Note: The alphanumeric code displayed above is the encrypted password. Replace it with your code.

Result: HelloWorld will be displayed which is encrypted above.

Similarly, we can view encrypted passwords in QTP also.

Data Execution Prevention error while recording in LoadRunner

What is Data Execution Prevention (DEP) in Windows?

Data Execution Prevention (DEP) helps prevent damage from viruses and other security threats that attack by running (executing) malicious code from memory locations that only Windows and other programs should use. This type of threat causes damage by taking over one or more memory locations in use by a program. Then it spreads and harms other programs, files, and even your e-mail contacts.

Unlike a firewall or antivirus program, DEP does not help prevent harmful programs from being installed on your computer. Instead, it monitors your programs to determine if they use system memory safely. To do this, DEP software works alone or with compatible microprocessors to mark some memory locations as "non-executable". If a program tries to run code—malicious or not—from a protected location, DEP closes the program and notifies you.

Is it safe to run a program again if DEP has closed it?

Yes, but only if you leave DEP turned on for that program. Windows can continue to detect attempts to execute code from protected memory locations and help prevent attacks.

How can I tell if DEP is available on my computer?
  1. To open System Properties, click Start, click Control Panel, and then double-click System.
  2. Click the Advanced tab and, under Performance, click Settings.
  3. Click the Data Execution Prevention tab.
By default, DEP is only turned on for essential Windows operating system programs and services.

How Data Execution Prevention affects recording using LoadRunner?
Sometimes when you try to record an application using LoadRunner in Windows, you get an error message looks similar to the following.


Here the application being blocked is Oracle SQL*PLUS. Since this is a trusted program, and to get around this problem, we need to disable DEP for this program or Enable DEP for rest of all Windows programs except this program.

To do that,
  1. To open System Properties, click Start, click Control Panel, and then double-click System.
  2. Click the Advanced tab and, under Performance, click Settings.
  3. Click the Data Execution Prevention tab 
  4. In this case, check Oracle SQL*PLUS
    5. Click on Ok and Ok on System Properties Window.


Try to record the same application again and this time it works.