crypto: add keyObject.params for asymmetric keys
This API exposes key parameters. It is conceptually different from the previously discussed keyObject.fields
property since it does not give access to information that could compromise the security of the key, and the obtained information cannot be used to uniquely identify a key.
The intended purpose is to determine "security properties" of keys, e.g. to generate a new key pair with the same parameters, or to decide whether a key is secure enough.
I have not implemented the publicExponent
property yet, mostly because I am not sure whether to use a number
or a BigInt
. In practice, most (all?) public exponents will fit into 32 bits and thus easily into Number.MAX_SAFE_INTEGER
, and generateKeyPair
currently only accepts safe integers, too. However, in theory, public exponents can be almost arbitrarily long, even though it can introduce efficiency and security concerns. I would like to hear opinions from @nodejs/crypto (or others).
Refs: https://github.com/nodejs/webcrypto/issues/16
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines