Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AES/ECB/PKCS5Padding in k6 #637

Closed
gushengyuan opened this issue May 21, 2018 · 3 comments
Closed

Use AES/ECB/PKCS5Padding in k6 #637

gushengyuan opened this issue May 21, 2018 · 3 comments

Comments

@gushengyuan
Copy link

I want to use AES/ECB/PKCS5Padding to encrypt the payload data, and i tried to use several nodejs modules include crypto-js which used to convert to a standalone module using browserify, but it still does'nt work,

Is there any one using AES/ECB/PKCS5Padding sucessfull in K6?

@na-- na-- changed the title is it possible to using AES/ECB/PKCS5Padding in k6 Use AES/ECB/PKCS5Padding in k6 May 22, 2018
@na--
Copy link
Member

na-- commented May 22, 2018

Try using some encryption library meant for the browser, not for node.js. You usually can't use node libraries directly in k6, since they often depend on functions in node's standard library, though browserify may help with that.

In general, even if the encryption using pure JavaScript works, it would probably be relatively slow and CPU-heavy. It's probably a good idea to expose some of Go's nice encryption capabilities in the JS runtime, like we currently do with the hashing functions. I've tagged this and edited the issue title slightly so we can use it to track the effort of adding fast "native" encryption in k6.

@gushengyuan
Copy link
Author

That's sounds great, thanks @na--
By now, I use CryptoJS instead althought there are lots of issues using it in k6.
I'm very expecting a new k6 version to support more cryptographic algorithm

@oleiade
Copy link
Member

oleiade commented Oct 4, 2023

We think the scope of this issue is addressed by the recent introduction of the k6/experimental/webcrypto module, which in its current state already offers support for AES encryption, using PKCS7 padding, as per the specification, which is, in theory, compatible with PKCS5 padding.

The Electronic Codebook (ECB) mode is generally considered insecure for most applications because it doesn't use an initialization vector (IV) and the same plaintext block will always produce the same ciphertext block. Due to its vulnerabilities, the WebCrypto API the module is based upon deliberately doesn't support ECB mode. Neither will k6, and if users need it, they might want to invest in developing an extension to support it.

@oleiade oleiade closed this as completed Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants