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 encrypted private -> public import #37056

Conversation

tniessen
Copy link
Member

This patch fixes the added test case. There is no reason for createPublicKey to not allow importing encrypted private keys. With this patch, the behavior matches the documentation.

@tniessen tniessen added the crypto Issues and PRs related to the crypto subsystem. label Jan 25, 2021
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jan 25, 2021
@tniessen
Copy link
Member Author

I personally consider the previous behavior a bug, so I am not labeling this as semver-minor.

@jasnell
Copy link
Member

jasnell commented Jan 25, 2021

As far as I can tell this is new functionality? This should likely be semver-minor.

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

semver-patch sounds good to me for this

@tniessen
Copy link
Member Author

@jasnell That depends on whether we consider the documented behavior or the actual behavior. The documentation says:

Because public keys can be derived from private keys, a private key may be passed instead of a public key. In that case, this function behaves as if crypto.createPrivateKey() had been called

Since, unlike createPrivateKey, createPublicKey ignored the passphrase parameter, this was not an accurate description of the actual behavior. Therefore, I'd consider this a bug fix.

On the other hand, if we ignore the documentation, then this is indeed a new feature.

Copy link
Member

@panva panva left a comment

Choose a reason for hiding this comment

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

semver-patch seems appropriate

@nodejs-github-bot
Copy link
Collaborator

@tniessen tniessen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 25, 2021
tniessen added a commit that referenced this pull request Jan 27, 2021
PR-URL: #37056
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@tniessen
Copy link
Member Author

Landed in c9992a0, thanks for reviewing.

@tniessen tniessen closed this Jan 27, 2021
@tniessen tniessen removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 27, 2021
@tniessen tniessen deleted the crypto-fix-createpublickey-with-passphrase branch January 27, 2021 14:43
targos pushed a commit that referenced this pull request Feb 2, 2021
PR-URL: #37056
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@targos targos mentioned this pull request Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants