sudhakar
sudhakar

Reputation: 11

How to encrypt the fetched data in jmeter using bean shell?

I have a scenario as follows: A value is extracted from the server response and is to be encrypted and pass to the subsequent request. How can it be done using bean shell. And what are the jar files I have to include to run the script?

Upvotes: 1

Views: 1582

Answers (1)

Ori Marko
Ori Marko

Reputation: 58774

Generally if you have decrypt class e.g. Decryptor in jar e.g. x.jar

  1. Click Test Plan, below in Add Library Click Browse and add your x.jar.

  2. Add Beanshell Sampler (or JSR223 Sampler)

Get encrypted variable e.g. paramName

Put in new variable e.g. paramNameDecrypted the decrypt value

Code:

import package.Decryptor;

String decryptValue = Decryptor.decrypt(vars.get("paramName"));

vars.put("paramNameDecrypted", decryptValue)

Upvotes: 1

Related Questions