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

Implement Crypto.subtle #26878

Open
jdm opened this issue Jun 11, 2020 · 4 comments
Open

Implement Crypto.subtle #26878

jdm opened this issue Jun 11, 2020 · 4 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented Jun 11, 2020

https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto

This is used in the hub.link flow for joining a hubs room on a VR device.

@jdm jdm added the A-content/dom label Jun 11, 2020
@jdm
Copy link
Member Author

@jdm jdm commented Jun 11, 2020

Hubs relies on the deriveKey, generateKey, importKey, exportKey, encrypt, and decrypt methods.

@jdm jdm added this to To do in Hubs support Jun 11, 2020
@jdm
Copy link
Member Author

@jdm jdm commented Jul 10, 2020

Hubs relies specifically on:

  • ECDH (deriveKey, generateKey)
  • AES-CBC (deriveKey, encrypt, decrypt)
  • jwk (exportKey, importKey)
  • P-256 (importKey, generateKey)
@jdm
Copy link
Member Author

@jdm jdm commented Jul 10, 2020

I've started tinkering in https://github.com/jdm/servo/tree/subtle.

@jdm
Copy link
Member Author

@jdm jdm commented Jul 14, 2020

ring may be a useful basis for this work. Gecko relies on NSS (eg. https://searchfox.org/mozilla-central/rev/82c04b9cad5b98bdf682bd477f2b1e3071b004ad/dom/crypto/WebCryptoTask.cpp#2727 for the ECDH implementation for deriveKey).

https://docs.rs/ring/0.16.15/ring/agreement/index.html has APIs involving ECDH, the P256 curve. However, it doesn't seem to have AES-CBC support. The RustCrypto group has https://docs.rs/aes/0.4.0/aes/ which looks like it might suit. Given that, we may just want to rely on the elliptic_curve and p256 crates instead of ring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Hubs support
  
To do
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.