javascript - How to import Cryptojs in Jmeter - Stack Overflow

In one of the http request we have to send encrypted value.The encryption is done by the CryptoJs javas

In one of the http request we have to send encrypted value.

The encryption is done by the CryptoJs javascript libraries and Algorithm used is AES256.

I am new to Jmeter can anyone let me know how to import the CryptoJs libraries and how to use the function of same to encrypt and decrypt the same.

In one of the http request we have to send encrypted value.

The encryption is done by the CryptoJs javascript libraries and Algorithm used is AES256.

I am new to Jmeter can anyone let me know how to import the CryptoJs libraries and how to use the function of same to encrypt and decrypt the same.

Share asked Oct 13, 2016 at 7:39 Shrikant BorseShrikant Borse 1751 gold badge2 silver badges10 bronze badges 1
  • Any feedback on answer ? if ok it should be accepted and upvoted so that users know it is usable. Thx – UBIK LOAD PACK Commented Oct 18, 2016 at 6:45
Add a ment  | 

2 Answers 2

Reset to default 4

I recall answering something similar already, see How to load external js library in Jmeter?

Quoting myself:

Use Rhino load() method like:

   load("crypto.js")

Given the guy wasn't able to use the instruction here is a little bit extended version:

  1. Download the required version of CryptoJS from the releases page and unpack it somewhere

  2. Using load method provide full path to crypto-js.js file like:

    /tmp/crypto-js-3.1.7/crypto-js.js
    
  3. Access methods like

    • CryptoJS.SHA256(...)
    • CryptoJS.AES(...)
    • etc.

Demo:

If the values are static and you don't have a lot of them a better idea could be storing them into a file and accessing via i.e. CSV Data Set Config

JMeter is not a browser.

Javascript is run through Rhino or Nashorn.

So your best option is to look at CryptoJS code and either:

  • use it in a JSR223-Preprocessor using Javascript language

  • Translate code to Groovy/Java using JSR223-Preprocessor + groovy

See:

  • Java 256-bit AES Password-Based Encryption

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745067304a4609330.html

相关推荐

  • javascript - How to import Cryptojs in Jmeter - Stack Overflow

    In one of the http request we have to send encrypted value.The encryption is done by the CryptoJs javas

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信