Skip to content
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 from

Conversation

tniessen
Copy link
Member

@tniessen 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

@nodejs-github-bot nodejs-github-bot added the crypto Issues and PRs related to the crypto subsystem. label Jan 3, 2019
Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

@sam-github sam-github left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, modulo a nit about the security advice.

doc/api/crypto.md Outdated Show resolved Hide resolved
@tniessen
Copy link
Member Author

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
Copy link
Member Author

tniessen commented Jan 4, 2019

@danbev
Copy link
Contributor

danbev commented Jan 7, 2019

Landed in 7afdfae.

@danbev danbev closed this Jan 7, 2019
danbev pushed a commit that referenced this pull request Jan 7, 2019
PR-URL: #25326
Fixes: #25322
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax pushed a commit that referenced this pull request Jan 9, 2019
PR-URL: #25326
Fixes: #25322
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
PR-URL: nodejs#25326
Fixes: nodejs#25322
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Jan 16, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
PR-URL: nodejs#25326
Fixes: nodejs#25322
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Issues and PRs related to the crypto subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generateKeyPairSync doesn't return KeyObject
7 participants