w3c / webcrypto

The W3C Web Cryptography API
https://w3c.github.io/webcrypto/
Other
263 stars 53 forks source link

Throw when length == 0 in the ECDH derive bits operation #351

Open twiss opened 9 months ago

twiss commented 9 months ago

(Spun off from https://github.com/w3c/webcrypto/pull/345#issuecomment-1682720871. Should only be merged after #345, as otherwise this change will cause an error to be thrown for null as well, which is not the intention here.)

Current behavior for calling deriveBits on an ECDH key with length == 0:

Changing all implementations to return an empty value seems potentially dangerous on the off-chance that a WebKit-specific application relies on receiving the entire value.

Changing all implementations to return the entire value seems somewhat nonsensical :)

Changing all implementations to throw an error seems (IMHO) reasonable, and should be web-compatible as Mozilla already does so.


Preview | Diff