@@ -2622,31 +2622,6 @@ generateKey('hmac', { length: 64 }, (err, key) => {
2622
2622
});
2623
2623
```
2624
2624
2625
- ### ` crypto.generateKeySync(type, options) `
2626
- <!-- YAML
2627
- added: v15.0.0
2628
- -->
2629
-
2630
- * ` type ` : {string} The intended use of the generated secret key. Currently
2631
- accepted values are ` 'hmac' ` and ` 'aes' ` .
2632
- * ` options ` : {Object}
2633
- * ` length ` : {number} The bit length of the key to generate.
2634
- * If ` type ` is ` 'hmac' ` , the minimum is 1, and the maximum length is
2635
- 2<sup >31</sup >-1. If the value is not a multiple of 8, the generated
2636
- key will be truncated to ` Math.floor(length / 8) ` .
2637
- * If ` type ` is ` 'aes' ` , the length must be one of ` 128 ` , ` 192 ` , or ` 256 ` .
2638
- * Returns: {KeyObject}
2639
-
2640
- Synchronously generates a new random secret key of the given ` length ` . The
2641
- ` type ` will determine which validations will be performed on the ` length ` .
2642
-
2643
- ``` js
2644
- const { generateKeySync } = require (' crypto' );
2645
-
2646
- const key = generateKeySync (' hmac' , 64 );
2647
- console .log (key .export ().toString (' hex' )); // e89..........41e
2648
- ```
2649
-
2650
2625
### ` crypto.generateKeyPair(type, options, callback) `
2651
2626
<!-- YAML
2652
2627
added: v10.12.0
@@ -2790,6 +2765,31 @@ The return value `{ publicKey, privateKey }` represents the generated key pair.
2790
2765
When PEM encoding was selected, the respective key will be a string, otherwise
2791
2766
it will be a buffer containing the data encoded as DER.
2792
2767
2768
+ ### ` crypto.generateKeySync(type, options) `
2769
+ <!-- YAML
2770
+ added: v15.0.0
2771
+ -->
2772
+
2773
+ * ` type ` : {string} The intended use of the generated secret key. Currently
2774
+ accepted values are ` 'hmac' ` and ` 'aes' ` .
2775
+ * ` options ` : {Object}
2776
+ * ` length ` : {number} The bit length of the key to generate.
2777
+ * If ` type ` is ` 'hmac' ` , the minimum is 1, and the maximum length is
2778
+ 2<sup >31</sup >-1. If the value is not a multiple of 8, the generated
2779
+ key will be truncated to ` Math.floor(length / 8) ` .
2780
+ * If ` type ` is ` 'aes' ` , the length must be one of ` 128 ` , ` 192 ` , or ` 256 ` .
2781
+ * Returns: {KeyObject}
2782
+
2783
+ Synchronously generates a new random secret key of the given ` length ` . The
2784
+ ` type ` will determine which validations will be performed on the ` length ` .
2785
+
2786
+ ``` js
2787
+ const { generateKeySync } = require (' crypto' );
2788
+
2789
+ const key = generateKeySync (' hmac' , 64 );
2790
+ console .log (key .export ().toString (' hex' )); // e89..........41e
2791
+ ```
2792
+
2793
2793
### ` crypto.generatePrime(size[, options[, callback]]) `
2794
2794
<!-- YAML
2795
2795
added: v15.8.0
@@ -2872,19 +2872,6 @@ By default, the prime is encoded as a big-endian sequence of octets
2872
2872
in an {ArrayBuffer}. If the ` bigint ` option is ` true ` , then a {bigint}
2873
2873
is provided.
2874
2874
2875
- ### ` crypto.getCiphers() `
2876
- <!-- YAML
2877
- added: v0.9.3
2878
- -->
2879
-
2880
- * Returns: {string[ ] } An array with the names of the supported cipher
2881
- algorithms.
2882
-
2883
- ``` js
2884
- const ciphers = crypto .getCiphers ();
2885
- console .log (ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...]
2886
- ```
2887
-
2888
2875
### ` crypto.getCipherInfo(nameOrNid[, options]) `
2889
2876
<!-- YAML
2890
2877
added: v15.0.0
@@ -2914,6 +2901,19 @@ ciphers. To test if a given key length or iv length is acceptable for given
2914
2901
cipher, use the ` keyLenth ` and ` ivLenth ` options. If the given values are
2915
2902
unacceptable, ` undefined ` will be returned.
2916
2903
2904
+ ### ` crypto.getCiphers() `
2905
+ <!-- YAML
2906
+ added: v0.9.3
2907
+ -->
2908
+
2909
+ * Returns: {string[ ] } An array with the names of the supported cipher
2910
+ algorithms.
2911
+
2912
+ ``` js
2913
+ const ciphers = crypto .getCiphers ();
2914
+ console .log (ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...]
2915
+ ```
2916
+
2917
2917
### ` crypto.getCurves() `
2918
2918
<!-- YAML
2919
2919
added: v2.3.0
0 commit comments