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

ECDH -> AES-GCM Key Derivation for message encryption is broken #28

Closed
reznik99 opened this issue Dec 5, 2022 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@reznik99
Copy link
Owner

reznik99 commented Dec 5, 2022

const sessionKey = await window.crypto.subtle.deriveKey(

Issues:

  • Keypair curve is P384 which means the length of output bits is too long.
  • SubtleCrypto ECDH DeriveKey isn't suitable to directly derive an AES-GCM key directly as it uses the raw DH output and doesn't pass it through any kind of KDF.

Solution is to manually derive the ECDH bits and pass through PBKDF2 to derive the AES-GCM key.

webcrypto/issues/193

@reznik99
Copy link
Owner Author

reznik99 commented Dec 6, 2022

@reznik99 reznik99 added the bug Something isn't working label Dec 6, 2022
@reznik99 reznik99 closed this as completed Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant