SHA256WithRSA signatute in k6

Hello experts,
Here is a requirement to sign a private key and text with “SHA256WithRSA” algo. But after doing many search over the documentation of k6 I didn’t find any algo “SHA256WithRSA”

Link: https://k6.io/docs/javascript-api/k6-crypto

Hi there,

sorry, this scheme is not supported natively in k6. A workaround might be to do the signing outside of k6 and then load the file with open() in the script.

1 Like

Hi @sanjay.bansal57,

One way to include external modules is by bundling modules. Apart from that, have a look at these JavaScript libraries and try to see if you can make it happen:

  1. sha.js
  2. hash.js
  3. crypto-js

Hope it helps you achieve your goals.

1 Like

Just to elaborate a bit more on @mostafa’s suggestion:

Those 3 libraries are pure javascript, which is a requirement to be able to bundle them (without external dependencies at runtime) using for instance webpack. As such, they might have serious performance implications, due to the fact that cryptographic work isn’t that well-suited for single-threaded, interpreted languages.

Happy testing! :tada:

1 Like