PeculiarVentures / webcrypto-core

A input validation layer for WebCrypto polyfills.
MIT License
28 stars 13 forks source link

deriveKey() function call missing from base provider #23

Closed tplooker closed 3 years ago

tplooker commented 4 years ago

Hi is there any plan to support or are you will to accept a PR that adds using the deriveKey() api, in the core provider?

microshine commented 4 years ago

Provider implements deriveBits function. I think it's enough for the key derivation.

webcrypto-core implements deriveKey in SubtleCrypto class.

deriveKey
  - derive bits
  - import key

Does it work for you? Why do you want deriveKey in the Provider class?

tplooker commented 4 years ago

Hi, in general we are interested in seeing if we can expand support in this library for X25519/Curve25519 for DH and ed25519 for EDDSA. Most of the operations are relatively straightforward to implement.

Draft EDDSA implementation

We would also like to support a derive key operation that converts a ed25519 from an x25519 hence the interest in the derive key operation.

microshine commented 4 years ago

webcrypto-core is base project which doesn't implement crypto mechanisms. I'm using that project for the arguments checking only.

See NodeJS WebCrypto and (Browser WebCrypto)(https://github.com/PeculiarVentures/webcrypto-liner) implementations

We would also like to support a derive key operation that converts a ed25519 from an x25519 hence the interest in the derive key operation

I'm not sure this is a good idea. You cant convert ECDSA to ECDH without exportKey and importKey functions. Use standard operations to implement this conversion.

What about deriveKey, as I told before you must implement deriveBits function. After that, you can start to use deriveKey from the SubtleCrypto class (eg ECDH key derivation).

tplooker commented 4 years ago

Hi, I realize this is just the input validation layer however it must support validation of the parameters for EDDSA and ECDH with X25519. I will review the example you have linked. Would you accept a PR for an addition of the this?

rmhrisk commented 4 years ago

We are interested in supporting these however we do want to make sure we do so in a way that’s architecture consistent.

microshine commented 3 years ago

@peculiar/webcrypto@1.1.6 supports those mechanisms https://github.com/PeculiarVentures/webcrypto/pull/25