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

feat(ext/crypto): export elliptic keys as "raw" #14764

Merged
merged 1 commit into from
Jun 8, 2022
Merged

feat(ext/crypto): export elliptic keys as "raw" #14764

merged 1 commit into from
Jun 8, 2022

Conversation

diachedelic
Copy link
Contributor

This pull request chips away at the WebCrypto roadmap (#11690). It adds support for the "raw" format when exporting public ECDH/ECDSA keys via the SubtleCrypto.exportKey method.

The WebCrypto specification explicitly states that support for the "raw" format is encouraged for interoperability.

As a newbie contributor, are there tests for ext/crypto? I could not find any.

@CLAassistant
Copy link

CLAassistant commented Jun 1, 2022

CLA assistant check
All committers have signed the CLA.

@lucacasonato
Copy link
Member

As a newbie contributor, are there tests for ext/crypto? I could not find any.

There are two types of tests for Web Crypto. Some simple ones in https://github.com/denoland/deno/blob/main/cli/tests/unit/webcrypto_test.ts, and an extensive test suite in the Web Platform Tests. You probably just need to update the WPT expectations file to match this new feature. See Manual: Contributing > Web Platform Tests.

@diachedelic diachedelic requested a review from bartlomieju as a code owner June 1, 2022 08:12
@diachedelic
Copy link
Contributor Author

diachedelic commented Jun 1, 2022

I've added some unit tests. Oddly enough, the WPT suite does not seem to test exportKey, only importKey.

@diachedelic
Copy link
Contributor Author

I've signed the CLA three times in the last week, and it's still pending.

@bartlomieju
Copy link
Member

I've signed the CLA three times in the last week, and it's still pending.

@diachedelic are you sure you used the same GH account to sign the CLA?

@jamesdiacono
Copy link
Contributor

Right you are! I had to sign it with my other GitHub account, because the CLAssistant looks at the email address in the actual commit.

Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

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

LGTM, just one minor nit.

@@ -144,7 +144,7 @@ impl RawKeyData {
)
})?;
let point = p384::EncodedPoint::from_bytes(&ec_key.encoded_point)
.map_err(|_| data_error("expected valid public EC key"))?;
.map_err(|_| data_error("expected valid private EC key"))?;
Copy link
Member

Choose a reason for hiding this comment

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

This is the public encoded point - the error should not be for private key decoding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, fixed.

This commit chips away at the WebCrypto roadmap (#11690). It adds
support for the "raw" format when exporting public ECDH/ECDSA keys via
the SubtleCrypto.exportKey method.
@littledivy littledivy merged commit ff5def9 into denoland:main Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants