Unanswered question

How to use CryptoJS HMAC SHA256 in neoload

Service Client:

The request URL is signed with token as private key using CryptoJS.HmacSHA256 and the signature is
then encoded to Base64 string. The encoded signature is added along with the Login to the request
header ‘Authentication’.
For login authentication we need to convert token into above format.

Nrusingh P.
Nrusingh P.

Nrusingh P.

Level
0
77 / 100
points

Answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

You should be able to execute that JS code in NeoLoad. Download the two JS's to encrypt and encode your message and create them as JS library in NeoLoad from menu "Edit-->JS libraries

Then from a NeoLoad Javascript, call those crypto methods to use them.

You can find some examples on the Internet like from here

Deepak G.
Deepak G.

Deepak G.

Level
0
67 / 100
points

@Nouredine A. I am using this in JS Library and unable to call it to the Javascript element, when i run this it says the method is not defined in JS Library.

Chirapapan P.
Chirapapan P.

Chirapapan P.

Level
0
87 / 100
points

@Nouredine I have the same problem. Neoload should have a tutorial on how to use CryptoJS HMAC SHA256 since most of the application is using this security now. By the way, the link you gave to the example of using crypto methods especially on Javascript will not work since Neoload will not allow using document.createElement.

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

@Chirapapan. You're right but it was not meant to use the same exact JS. You need to adapt it using logger and getValue method from NeoLoad Javascript.

The rest is almost the same and you can use the examples to guide you.