Friday, June 7, 2013

How to encrypt a string in Loadrunner using password encoder? How to use the encrypted value in script?

Suppose you face a situation, when you want to encrypt your password and use this value in script. This is a cake walk.

You have to go to password encoder, the Password Encoder tool lets you enter regular text and convert it to an encoded string.

Choose Start > Programs > LoadRunner > Tools > Password Encoder to open the Password Encoder tool.



Password: Enter the password you want to encode, and then click Generate.
Encoded string: Displays the encoded password string.
Generate: Generates an encoded string after a password is entered.
Copy: Copies the encoded password string to the clipboard.

Done!!!

Now, How to use the encrypted value in script?
Click here to know more

This is done by using lr_decrypt function as shown below in script.

vuser_init()
{
    web_set_proxy("oregon:8080");
    web_set_user("oregon_user",

    lr_decrypt("518a296870b8b8d477e2f63cbbe5f2a0")," oregon:8080");
    web_url("web_url",
        "URL=http:// oregoncity.com /",
        "TargetFrame=",
        "Resource=0",
        "Referer=",
        LAST );

}

4 comments:

  1. how would I use this in the Value par of a web_submit_data function?

    "Name=psword", "Value=password", ENDITEM,

    Regards,
    saka

    ReplyDelete
  2. First of all encrypt your password using password encoder and then use lr_eval_string function and lr_decrypt to pass that value in web_submit_data.
    The final api will look like:

    web_submit_data(..
    ..
    "Name=psword","Value={lr_eval_string(lr_decrypt("value_from_encoder"))}"
    ..
    .., LAST);

    Thanks,
    Devendra

    ReplyDelete
  3. What type the encryption use password encoder..??

    ReplyDelete
  4. Hi,

    The Vugen uses a 32-bit encryption to encode the password.

    Thanks,
    Dev

    ReplyDelete