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): generate ECDH keys #11870

Merged
merged 2 commits into from
Sep 13, 2021

Conversation

lucacasonato
Copy link
Member

Add support for ECDH algorithm in SubtleCrypto#generateKey.

Towards #11690

Add support for ECDH algorithm in SubtleCrypto#generateKey.
@@ -162,7 +162,7 @@ pub async fn op_crypto_generate_key(

private_key.to_pkcs8_der()?.as_ref().to_vec()
}
Algorithm::Ecdsa => {
Algorithm::Ecdsa | Algorithm::Ecdh => {
Copy link
Member

@littledivy littledivy Aug 29, 2021

Choose a reason for hiding this comment

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

The ECKeyPair is generated using ring::signature::EcdsaKeyPair::generate_pkcs8. Is this the correct way?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The spec says to generate an "Elliptic Curve key pair' for both cases. ECDSA and ECDH are two algorithms for encryption/decryption, and key agreement respectively. They both operate using EC keys though.

@bartlomieju bartlomieju added this to the 1.14.0 milestone Sep 4, 2021
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM - Nice!

@lucacasonato lucacasonato merged commit d0b5ff6 into denoland:main Sep 13, 2021
@lucacasonato lucacasonato deleted the ecdh_keygen branch September 13, 2021 09:36
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.

4 participants