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

[2/3] Implement the exportKey and importKey operations with support for HMAC algorithm #38

Merged
merged 5 commits into from
Apr 5, 2023

Conversation

oleiade
Copy link
Member

@oleiade oleiade commented Mar 30, 2023

What is this?

This Pull Request adds support for the HMAC algorithm to the subtle.crypto.importKey and subtle.crypto.exportKey operations. It is the second PR of a chain of three PRs converging towards introducing the sign and verify APIs to the extension.

Our plan moving forward is to go breadth first, and implement as much of the WebCrypto API's surface, and only later to add support for more algorithms. As a result this PR comes in with the intention to support the ability to implement the sign and verify operations to the module.

Just like with encrypt and decrypt, the sign and verify operations test suite rely on the ability to import and export a key of a support algorithm. As a result to support sign and verify with a scope reduced to the HMAC algorithm, we need to implement importKey and exportKey first.

Review

Note that like in the generateKey PR we introduce a new interface for key import: KeyImporter. Although we could have extended this principle to key export, we decided to delay that until we support key pairs, as we lack visibility to decide whether or not this will remain a good abstraction in the future.

This PR is based on the HMAC support for the generateKey PR, and will act as the base for a third PR to come which will introduce the sign and verify methods to the extension.

@oleiade oleiade changed the base branch from main to feature/generateKey-hmac March 30, 2023 15:23
Base automatically changed from feature/generateKey-hmac to main March 31, 2023 08:39
@oleiade oleiade force-pushed the feature/importKey-exportKey-hmac branch from 66d876d to 295b13e Compare March 31, 2023 08:40
Copy link

@codebien codebien left a comment

Choose a reason for hiding this comment

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

LGTM

webcrypto/hmac.go Show resolved Hide resolved
webcrypto/subtle_crypto.go Show resolved Hide resolved
webcrypto/aes.go Outdated Show resolved Hide resolved
webcrypto/hmac.go Outdated Show resolved Hide resolved
@oleiade oleiade force-pushed the feature/importKey-exportKey-hmac branch from d2fab94 to 3649773 Compare April 3, 2023 10:07
@oleiade oleiade self-assigned this Apr 3, 2023
@oleiade oleiade added the enhancement New feature or request label Apr 3, 2023
@oleiade oleiade force-pushed the feature/importKey-exportKey-hmac branch from 3649773 to 68f9533 Compare April 3, 2023 10:13
Copy link

@codebien codebien left a comment

Choose a reason for hiding this comment

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

LGTM

@oleiade oleiade merged commit 336b266 into main Apr 5, 2023
@oleiade oleiade deleted the feature/importKey-exportKey-hmac branch April 5, 2023 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants