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

Support of RSA #85

Merged
merged 12 commits into from
Oct 25, 2024
Merged

Support of RSA #85

merged 12 commits into from
Oct 25, 2024

Conversation

olegbespalov
Copy link
Contributor

@olegbespalov olegbespalov commented Oct 22, 2024

What?

This PR brings support for the RSA algorithms across available APIs.

Sorry for the huge PR, but the predominant issue is that to make RSA useful (sign, verify, encrypt, decrypt), we need to have a lot of functionality already (generation, export, import), so it's kind of all related. However, I did break pieces in commits, so you could try checking them.

The vital highlight could be that for the RSA-PSS algorithm, we don't support saltLength 0 (since golang SDK doesn't support it). So, I'm thinking of also writing a log message whenever a user uses this to bring attention. But this will be in a separate PR.

Why?

Closes: #47
Closes: #84

@olegbespalov olegbespalov self-assigned this Oct 22, 2024
@olegbespalov olegbespalov force-pushed the feat/rsa branch 4 times, most recently from 2e90a4a to af8f773 Compare October 24, 2024 13:13
@olegbespalov olegbespalov changed the title WIP: Support of RSA Support of RSA Oct 24, 2024
@olegbespalov olegbespalov marked this pull request as ready for review October 24, 2024 13:21
@olegbespalov olegbespalov requested a review from a team as a code owner October 24, 2024 13:21
@olegbespalov olegbespalov requested review from mstoykov and oleiade and removed request for a team October 24, 2024 13:21
@olegbespalov olegbespalov mentioned this pull request Oct 24, 2024
@Billyzou0741326
Copy link

I think this closes #84 too. Thanks for the quick implementation

Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work 👏🏻 🚀 Feels great to see RSA coming to k6. Left a couple of absolutely disposable nits, but looks all good to me 🙇🏻

webcrypto/subtle_crypto.go Outdated Show resolved Hide resolved
webcrypto/key.go Outdated Show resolved Hide resolved
@olegbespalov olegbespalov changed the base branch from main to feat/web-platform-tests October 25, 2024 11:39
- setup({explicit_done: true});
+ // setup({explicit_done: true});

- var subtle = self.crypto.subtle; // Change to test prefixed implementations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it won't be easier to actually set self to globalThis which seems to be what it meant to do https://developer.mozilla.org/en-US/docs/Web/API/Window/self

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let me address this after merging this and #87 as part as clean up

Comment on lines +192 to +196
gotErr := ts.EventLoop.Start(func() error {
err := executeTestScripts(ts.VU.Runtime(), webPlatformTestSuite+"encrypt_decrypt", "rsa_vectors.js", "rsa.js")
require.NoError(t, err)

_, err = ts.VU.Runtime().RunString(`run_test()`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a lot of this test semm ... the same apart from the name and the some strings here.

It might be .. .better to make them into a table test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let me address this after merging this and #87 as part as clean up

Base automatically changed from feat/web-platform-tests to main October 25, 2024 14:36
@olegbespalov olegbespalov merged commit 234194a into main Oct 25, 2024
11 checks passed
@olegbespalov olegbespalov deleted the feat/rsa branch October 25, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants