FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

crypto: fix `generateKeyPair` with encoding 'jwk' by himself65 · Pull Request #39319 · nodejs/node · GitHub

/ node Public

crypto: fix generateKeyPair with encoding 'jwk' - #39319

Closed
himself65 wants to merge 17 commits into
nodejs:masterfrom
himself65:20210709-crypto-fix
Closed

crypto: fix generateKeyPair with encoding 'jwk'#39319
himself65 wants to merge 17 commits into
nodejs:masterfrom
himself65:20210709-crypto-fix

Conversation

Copy link
Copy Markdown
Member

Fixes: #39205

himself65 added the crypto Issues and PRs related to the crypto subsystem. label Jul 9, 2021
himself65 requested a review from jasnell July 9, 2021 04:09
github-actions Bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 9, 2021
himself65 changed the title crypto: fix enerateKeyPair with encoding 'jwk' crypto: fix generateKeyPair with encoding 'jwk' Jul 9, 2021
himself65 force-pushed the 20210709-crypto-fix branch 2 times, most recently from 8050957 to 68df3f7 Compare July 9, 2021 04:52
Comment thread lib/internal/crypto/keygen.js Outdated
Comment thread lib/internal/crypto/keygen.js Outdated

Trott commented Jul 10, 2021

Copy link
Copy Markdown
Member

@nodejs/crypto

panva self-requested a review July 10, 2021 21:03

panva left a comment
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@himself65

The PR's on a good track, but lacks some of the details that are present in KeyObject.prototype.export

more concretely

I think there are a few ways of moving forward

  • either moving these asserts to C and have export just call the appropriate C method
  • having generate piggyback on a keyobject and then returning the results of calling export on those
  • a combination of those, e.g. leave the passphrase part in JS but move the rest to C

Comment thread test/parallel/test-crypto-keygen.js Outdated
panva previously requested changes Jul 11, 2021
Comment thread test/parallel/test-crypto-keygen.js Outdated

Copy link
Copy Markdown
Member Author

kAsymmetricKeyJWKProperties is not a static method, so we have to call it after initialized.'

I'd like to move these to the C part. because the second way must have performance regression. And the third way looks like a too complex struct.

himself65 force-pushed the 20210709-crypto-fix branch 2 times, most recently from da40de3 to 790e4ff Compare July 14, 2021 02:51
himself65 and others added 5 commits July 19, 2021 11:00
Co-authored-by: Voltrex <mohammadkeyvanzade94@gmail.com>
Co-authored-by: Voltrex <mohammadkeyvanzade94@gmail.com>
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
himself65 force-pushed the 20210709-crypto-fix branch from 790e4ff to 5d0b081 Compare July 19, 2021 03:01

Copy link
Copy Markdown
Member Author

I've moved kAsymmetricKeyJWKProperties to the c++ part. is it correct?

Copy link
Copy Markdown
Member Author

const char* curve = nullptr;
switch (EVP_PKEY_id(pkey.get())) {
case EVP_PKEY_ED25519:
curve = "Ed25519";
break;
case EVP_PKEY_ED448:
curve = "Ed448";
break;
case EVP_PKEY_X25519:
curve = "X25519";
break;
case EVP_PKEY_X448:
curve = "X448";
break;
default:
UNREACHABLE();
}
if (target->Set(
env->context(),
env->jwk_crv_string(),
OneByteString(env->isolate(), curve)).IsNothing()) {
return Nothing<bool>();
}

panva requested a review from tniessen July 19, 2021 12:46
panva dismissed their stale review July 19, 2021 13:28

addressed

This comment has been minimized.

This comment has been minimized.

panva removed the needs-ci PRs that need a full CI run. label Jul 19, 2021

This comment has been minimized.

Copy link
Copy Markdown
Member Author

/cc @nodejs/crypto

This comment has been minimized.

panva added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jul 20, 2021

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member Author

Does anyone review this pr? I think this is a nice fix 🤔

panva commented Jul 24, 2021

Copy link
Copy Markdown
Member

cc @nodejs/crypto

panva added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 26, 2021

jasnell commented Jul 26, 2021

Copy link
Copy Markdown
Member

Landed in 257312a

jasnell closed this Jul 26, 2021
jasnell pushed a commit that referenced this pull request Jul 26, 2021
Fixes: #39205

PR-URL: #39319
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
panva removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 26, 2021
himself65 deleted the 20210709-crypto-fix branch July 30, 2021 12:50
targos pushed a commit that referenced this pull request Aug 2, 2021
Fixes: #39205

PR-URL: #39319
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos mentioned this pull request Aug 2, 2021
codebytere added a commit to electron/electron that referenced this pull request Aug 9, 2021
codebytere added a commit to electron/electron that referenced this pull request Aug 9, 2021
codebytere added a commit to electron/electron that referenced this pull request Aug 18, 2021
codebytere added a commit to electron/electron that referenced this pull request Aug 18, 2021
codebytere added a commit to electron/electron that referenced this pull request Aug 20, 2021
* chore: bump node in DEPS to v16.6.0

* chore: bump node in DEPS to v16.6.1

* crypto: fix generateKeyPair with encoding 'jwk'

nodejs/node#39319

* build: add library_files to gyp variables

nodejs/node#39293

* debugger: rename internal module

nodejs/node#39378

* chore: fixup patch indices

* deps: extract gtest source files to deps/googletest

nodejs/node#39386

* crypto: fix generateKeyPair with encoding 'jwk'

nodejs/node#39319

* deps: bump HdrHistogram_C to 0.11.2

nodejs/node#39462

* fixup! deps: extract gtest source files to deps/googletest

* chore: bump node in DEPS to v16.6.2

* chore: update patches

* deps: reflect c-ares source tree

nodejs/node#39653

* deps: update c-ares to 1.17.2

nodejs/node#39724

* fix: _ReadBarrier undefined symbol error on WOA arm64

* chore: update patches

* chore: bump node in DEPS to v16.7.0

* deps: upgrade to libuv 1.42.0

nodejs/node#39525

* chore: update filenames

* src: remove extra semicolons outside fns

* chore: fixup patch filenames

* chore: sort and alphabetize disabled tests

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
BlackHole1 pushed a commit to BlackHole1/electron that referenced this pull request Aug 30, 2021
* chore: bump node in DEPS to v16.6.0

* chore: bump node in DEPS to v16.6.1

* crypto: fix generateKeyPair with encoding 'jwk'

nodejs/node#39319

* build: add library_files to gyp variables

nodejs/node#39293

* debugger: rename internal module

nodejs/node#39378

* chore: fixup patch indices

* deps: extract gtest source files to deps/googletest

nodejs/node#39386

* crypto: fix generateKeyPair with encoding 'jwk'

nodejs/node#39319

* deps: bump HdrHistogram_C to 0.11.2

nodejs/node#39462

* fixup! deps: extract gtest source files to deps/googletest

* chore: bump node in DEPS to v16.6.2

* chore: update patches

* deps: reflect c-ares source tree

nodejs/node#39653

* deps: update c-ares to 1.17.2

nodejs/node#39724

* fix: _ReadBarrier undefined symbol error on WOA arm64

* chore: update patches

* chore: bump node in DEPS to v16.7.0

* deps: upgrade to libuv 1.42.0

nodejs/node#39525

* chore: update filenames

* src: remove extra semicolons outside fns

* chore: fixup patch filenames

* chore: sort and alphabetize disabled tests

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. lib / src Issues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using JWK as encoding format for public key in crypto.generateKeyPairSync() throws an error

7 participants


Back | FazBrowse Home | New Git URL