Commit 011910b
crypto: add keyObject.export() 'jwk' format option
Adds [JWK](https://tools.ietf.org/html/rfc7517) keyObject.export format
option.
Supported key types: `ec`, `rsa`, `ed25519`, `ed448`, `x25519`, `x448`,
and symmetric keys, resulting in JWK `kty` (Key Type) values `EC`,
`RSA`, `OKP`, and `oct`.
`rsa-pss` is not supported since the JWK format does not support
PSS Parameters.
`EC` JWK curves supported are `P-256`, `secp256k1`, `P-384`, and `P-521`
PR-URL: #37081
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>1 parent dc84c18 commit 011910bCopy full SHA for 011910b
File tree
Expand file treeCollapse file tree
14 files changed
+402
-25
lines changedOpen diff view settings
Filter options
- doc/api
- lib/internal
- crypto
- test
- fixtures/keys
- parallel
Expand file treeCollapse file tree
14 files changed
+402
-25
lines changedOpen diff view settings
Collapse file
+16-9Lines changed: 16 additions & 9 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1348 | 1348 | |
1349 | 1349 | |
1350 | 1350 | |
| 1351 | + |
| 1352 | + |
| 1353 | + |
| 1354 | + |
1351 | 1355 | |
1352 | 1356 | |
1353 | 1357 | |
1354 | | - |
| 1358 | + |
1355 | 1359 | |
1356 | | - |
1357 | | - |
| 1360 | + |
1358 | 1361 | |
1359 | | - |
1360 | | - |
| 1362 | + |
1361 | 1363 | |
1362 | 1364 | |
1363 | 1365 | |
1364 | 1366 | |
1365 | | - |
| 1367 | + |
1366 | 1368 | |
1367 | 1369 | |
1368 | 1370 | |
1369 | 1371 | |
1370 | 1372 | |
1371 | | - |
| 1373 | + |
1372 | 1374 | |
1373 | 1375 | |
1374 | 1376 | |
1375 | 1377 | |
1376 | 1378 | |
1377 | 1379 | |
1378 | | - |
1379 | | - |
| 1380 | + |
| 1381 | + |
| 1382 | + |
| 1383 | + |
| 1384 | + |
| 1385 | + |
1380 | 1386 | |
1381 | 1387 | |
1382 | 1388 | |
| ||
4355 | 4361 | |
4356 | 4362 | |
4357 | 4363 | |
| 4364 | + |
4358 | 4365 | |
4359 | 4366 | |
4360 | 4367 | |
|
Collapse file
+14Lines changed: 14 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
919 | 919 | |
920 | 920 | |
921 | 921 | |
| 922 | + |
| 923 | + |
| 924 | + |
| 925 | + |
| 926 | + |
| 927 | + |
| 928 | + |
| 929 | + |
| 930 | + |
| 931 | + |
| 932 | + |
| 933 | + |
922 | 934 | |
923 | 935 | |
924 | 936 | |
| ||
2716 | 2728 | |
2717 | 2729 | |
2718 | 2730 | |
| 2731 | + |
| 2732 | + |
2719 | 2733 | |
2720 | 2734 | |
2721 | 2735 | |
|
Collapse file
lib/internal/crypto/keys.js
Copy file name to clipboardExpand all lines: lib/internal/crypto/keys.js+55-5Lines changed: 55 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
22 | 22 | |
23 | 23 | |
24 | 24 | |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
25 | 30 | |
26 | 31 | |
27 | 32 | |
| ||
30 | 35 | |
31 | 36 | |
32 | 37 | |
| 38 | + |
| 39 | + |
33 | 40 | |
34 | 41 | |
35 | 42 | |
| ||
124 | 131 | |
125 | 132 | |
126 | 133 | |
127 | | - |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
128 | 143 | |
129 | 144 | |
130 | 145 | |
131 | 146 | |
132 | 147 | |
133 | 148 | |
| 149 | + |
134 | 150 | |
135 | 151 | |
136 | 152 | |
| ||
163 | 179 | |
164 | 180 | |
165 | 181 | |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
166 | 204 | |
167 | 205 | |
168 | 206 | |
169 | 207 | |
170 | 208 | |
171 | 209 | |
172 | 210 | |
173 | | - |
| 211 | + |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
174 | 216 | |
175 | 217 | |
176 | 218 | |
177 | | - |
| 219 | + |
178 | 220 | |
179 | 221 | |
180 | 222 | |
| ||
184 | 226 | |
185 | 227 | |
186 | 228 | |
187 | | - |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | + |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | + |
188 | 238 | |
189 | 239 | |
190 | 240 | |
191 | 241 | |
192 | 242 | |
193 | | - |
| 243 | + |
194 | 244 | |
195 | 245 | |
196 | 246 | |
|
Collapse file
+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
839 | 839 | |
840 | 840 | |
841 | 841 | |
| 842 | + |
| 843 | + |
842 | 844 | |
843 | 845 | |
844 | 846 | |
|
Collapse file
test/fixtures/keys/Makefile
Copy file name to clipboardExpand all lines: test/fixtures/keys/Makefile+41-1Lines changed: 41 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
75 | 75 | |
76 | 76 | |
77 | 77 | |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
78 | 86 | |
79 | 87 | |
80 | 88 | |
| ||
663 | 671 | |
664 | 672 | |
665 | 673 | |
666 | | - |
| 674 | + |
667 | 675 | |
668 | 676 | |
669 | 677 | |
| ||
733 | 741 | |
734 | 742 | |
735 | 743 | |
| 744 | + |
| 745 | + |
| 746 | + |
| 747 | + |
| 748 | + |
| 749 | + |
| 750 | + |
| 751 | + |
| 752 | + |
| 753 | + |
| 754 | + |
| 755 | + |
| 756 | + |
| 757 | + |
| 758 | + |
| 759 | + |
| 760 | + |
| 761 | + |
| 762 | + |
| 763 | + |
| 764 | + |
| 765 | + |
| 766 | + |
| 767 | + |
| 768 | + |
| 769 | + |
| 770 | + |
| 771 | + |
| 772 | + |
| 773 | + |
| 774 | + |
| 775 | + |
736 | 776 | |
737 | 777 | |
738 | 778 | |
|
Collapse file
test/fixtures/keys/ec_p256_private.pem
Copy file name to clipboard+5Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
Collapse file
test/fixtures/keys/ec_p256_public.pem
Copy file name to clipboard+4Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
Collapse file
test/fixtures/keys/ec_p384_private.pem
Copy file name to clipboard+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
Collapse file
test/fixtures/keys/ec_p384_public.pem
Copy file name to clipboard+5Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
Collapse file
test/fixtures/keys/ec_p521_private.pem
Copy file name to clipboard+8Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
0 commit comments