Uh oh!
There was an error while loading. Please reload this page.
crypto: add keyObject.asymmetricKeyDetails for asymmetric keys - #36188
crypto: add keyObject.asymmetricKeyDetails for asymmetric keys#36188panva wants to merge 4 commits into
Conversation
nodejs-github-bot
commented
Nov 20, 2020
Review requested:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
04b4cd1 to
3438ccaComparetniessen
commented
Nov 20, 2020
This seems to be a replacement for #30045 (which I'm fine with, I barely had time for any OSS recently), but it doesn't solve the problems mentioned there. For example, |
It uses the same internals as The alternative would be to return the same way as webcrypto input for rsa keygen (a Uint8Array) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tniessen
commented
Nov 28, 2020
Admittedly, this is an unlikely scenario, but still one that could occur, and I don't think we should design an API that we won't be able to patch later to support larger exponents. I know we had countless discussions about how to represent big integers in JavaScript, and I think I am leaning towards using JS Let's face it, JavaScript is not great for cryptography. Secure memory management is virtually impossible, and |
panva
commented
Nov 30, 2020
@tniessen it would be great if there was an effort to come to a consensus, i don't care one way or the other. The need for this API is clear and the topic was stalled for months. I took your PR as a reference and used the already existing internals after @jasnell's refactoring so that you don't have to worry about rebasing your PR and adjusting to refactored crypto. |
@tniessen 5cc9cf0 makes |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Did not consider this a goal of this PR. But let's see.
|
tniessen
commented
Nov 30, 2020
It's not strictly necessary, but I think it would be great :)
I can do the latter.
I believe my PR is older than DH support :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This API exposes key details. 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. closesnodejs#30045
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
panva
commented
Jan 14, 2021
tniessen
left a comment
There was a problem hiding this comment.
LGTM apart from one concern about the return value of GetAsymmetricKeyDetail.
| } | ||
| return result; | ||
| } |
There was a problem hiding this comment.
Suggestion, feel free to ignore: Out of curiosity, did you try benchmarking this versus
BigInt(`0x${Buffer.from(input).toString('hex')}`)Or, if performance really is a concern in this code path,
BigInt(`0x${Buffer.from(input.buffer,input.byteOffset,input.byteLength).toString('hex')}`)(I know that this is essentially the same as the existing function bigIntArrayToUnsignedInt above, I am just curious what the performance impact is.)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Jan 14, 2021
panva
commented
Jan 14, 2021
Landed in 1772ae7 |
This API exposes key details. 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. closes#30045 PR-URL: #36188 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
This patch changes GetRsaKeyDetail to work in older supported versions of OpenSSL. Refs: openssl/openssl#10217 PR-URL: #36877 Refs: #36188 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This API exposes key details. 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. closes#30045 PR-URL: #36188 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
This API exposes key details. 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.
This replaces and closes#30045
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes