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

crypto: fix key object wrapping in sync keygen #25326

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
7 participants
@tniessen
Copy link
Member

tniessen commented Jan 3, 2019

generateKeyPairSync incorrectly returns the native key object handle instead of the higher-level JS key object. This change fixes that and aligns the documentation with generateKeyPair.

Fixes: #25322

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
@cjihrig

cjihrig approved these changes Jan 3, 2019

Copy link
Contributor

cjihrig left a comment

LGTM. Would there be any benefit to calling getSymmetricKeySize() in the tests since that triggered the crash in #25322?

@sam-github
Copy link
Member

sam-github left a comment

lgtm, modulo a nit about the security advice.

Show resolved Hide resolved doc/api/crypto.md Outdated
@jasnell

jasnell approved these changes Jan 4, 2019

@tniessen

This comment has been minimized.

Copy link
Member

tniessen commented Jan 4, 2019

Would there be any benefit to calling getSymmetricKeySize() in the tests since that triggered the crash in #25322?

@cjihrig Good question! The function getSymmetricKeySize() is a native function and should not have been exposed to users, instead, the properties of the key object (such as type, asymmetricKeyType, symmetricKeySize) are exposed. I believe that testing these properties is enough, the only valid assertion for getSymmetricKeySize would be its nonexistence.

@tniessen

This comment has been minimized.

@danbev

This comment has been minimized.

Copy link
Member

danbev commented Jan 7, 2019

Landed in 7afdfae.

@danbev danbev closed this Jan 7, 2019

danbev added a commit that referenced this pull request Jan 7, 2019

crypto: fix key object wrapping in sync keygen
PR-URL: #25326
Fixes: #25322
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

addaleax added a commit that referenced this pull request Jan 9, 2019

crypto: fix key object wrapping in sync keygen
PR-URL: #25326
Fixes: #25322
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

refack added a commit to refack/node that referenced this pull request Jan 14, 2019

crypto: fix key object wrapping in sync keygen
PR-URL: nodejs#25326
Fixes: nodejs#25322
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

@BridgeAR BridgeAR referenced this pull request Jan 16, 2019

Merged

v11.7.0 proposal #25537

BridgeAR added a commit to BridgeAR/node that referenced this pull request Jan 16, 2019

crypto: fix key object wrapping in sync keygen
PR-URL: nodejs#25326
Fixes: nodejs#25322
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment