@@ -68,8 +68,8 @@ const cert2 = crypto.Certificate();
68
68
added: v0.11.8
69
69
-->
70
70
- ` spkac ` {string | Buffer | TypedArray | DataView}
71
- - Returns {Buffer} The challenge component of the ` spkac ` data structure, which
72
- includes a public key and a challenge.
71
+ - Returns: {Buffer} The challenge component of the ` spkac ` data structure, which
72
+ includes a public key and a challenge.
73
73
74
74
``` js
75
75
const cert = require (' crypto' ).Certificate ();
@@ -84,8 +84,8 @@ console.log(challenge.toString('utf8'));
84
84
added: v0.11.8
85
85
-->
86
86
- ` spkac ` {string | Buffer | TypedArray | DataView}
87
- - Returns {Buffer} The public key component of the ` spkac ` data structure,
88
- which includes a public key and a challenge.
87
+ - Returns: {Buffer} The public key component of the ` spkac ` data structure,
88
+ which includes a public key and a challenge.
89
89
90
90
``` js
91
91
const cert = require (' crypto' ).Certificate ();
@@ -100,8 +100,8 @@ console.log(publicKey);
100
100
added: v0.11.8
101
101
-->
102
102
- ` spkac ` {Buffer | TypedArray | DataView}
103
- - Returns {boolean} ` true ` if the given ` spkac ` data structure is valid, ` false `
104
- otherwise.
103
+ - Returns: {boolean} ` true ` if the given ` spkac ` data structure is valid,
104
+ ` false ` otherwise.
105
105
106
106
``` js
107
107
const cert = require (' crypto' ).Certificate ();
@@ -178,10 +178,10 @@ console.log(encrypted);
178
178
added: v0.1.94
179
179
-->
180
180
- ` outputEncoding ` {string}
181
-
182
- Returns any remaining enciphered contents. If ` outputEncoding `
183
- parameter is one of ` 'latin1' ` , ` 'base64' ` or ` 'hex' ` , a string is returned.
184
- If an ` outputEncoding ` is not provided, a [ ` Buffer ` ] [ ] is returned.
181
+ - Returns: {Buffer | string} Any remaining enciphered contents.
182
+ If ` outputEncoding ` parameter is one of ` 'latin1' ` , ` 'base64' ` or ` 'hex' ` ,
183
+ a string is returned. If an ` outputEncoding ` is not provided , a [ ` Buffer ` ] [ ]
184
+ is returned.
185
185
186
186
Once the ` cipher.final() ` method has been called, the ` Cipher ` object can no
187
187
longer be used to encrypt data. Attempts to call ` cipher.final() ` more than
@@ -204,10 +204,10 @@ The `cipher.setAAD()` method must be called before [`cipher.update()`][].
204
204
<!-- YAML
205
205
added: v1.0.0
206
206
-->
207
-
208
- When using an authenticated encryption mode (only ` GCM ` is currently
209
- supported), the ` cipher.getAuthTag() ` method returns a [ ` Buffer ` ] [ ] containing
210
- the _ authentication tag _ that has been computed from the given data.
207
+ - Returns: {Buffer} When using an authenticated encryption mode (only ` GCM ` is
208
+ currently supported), the ` cipher.getAuthTag() ` method returns a [ ` Buffer ` ] [ ]
209
+ containing the _ authentication tag _ that has been computed from the given
210
+ data.
211
211
212
212
The ` cipher.getAuthTag() ` method should only be called after encryption has
213
213
been completed using the [ ` cipher.final() ` ] [ ] method.
@@ -217,7 +217,7 @@ been completed using the [`cipher.final()`][] method.
217
217
added: v0.7.1
218
218
-->
219
219
- ` autoPadding ` {boolean} ** Default:** ` true `
220
- - Returns the {Cipher} for method chaining.
220
+ - Returns: {Cipher} for method chaining.
221
221
222
222
When using block encryption algorithms, the ` Cipher ` class will automatically
223
223
add padding to the input data to the appropriate block size. To disable the
@@ -242,6 +242,7 @@ changes:
242
242
- ` data ` {string | Buffer | TypedArray | DataView}
243
243
- ` inputEncoding ` {string}
244
244
- ` outputEncoding ` {string}
245
+ - Returns: {Buffer | string}
245
246
246
247
Updates the cipher with ` data ` . If the ` inputEncoding ` argument is given,
247
248
its value must be one of ` 'utf8' ` , ` 'ascii' ` , or ` 'latin1' ` and the ` data `
@@ -331,10 +332,10 @@ console.log(decrypted);
331
332
added: v0.1.94
332
333
-->
333
334
- ` outputEncoding ` {string}
334
-
335
- Returns any remaining deciphered contents. If ` outputEncoding `
336
- parameter is one of ` 'latin1' ` , ` 'ascii' ` or ` 'utf8' ` , a string is returned.
337
- If an ` outputEncoding ` is not provided, a [ ` Buffer ` ] [ ] is returned.
335
+ - Returns: {Buffer | string} Any remaining deciphered contents.
336
+ If ` outputEncoding ` parameter is one of ` 'latin1' ` , ` 'ascii' ` or ` 'utf8' ` ,
337
+ a string is returned. If an ` outputEncoding ` is not provided , a [ ` Buffer ` ] [ ]
338
+ is returned.
338
339
339
340
Once the ` decipher.final() ` method has been called, the ` Decipher ` object can
340
341
no longer be used to decrypt data. Attempts to call ` decipher.final() ` more
@@ -349,7 +350,7 @@ changes:
349
350
description: This method now returns a reference to `decipher`.
350
351
-->
351
352
- ` buffer ` {Buffer | TypedArray | DataView}
352
- - Returns the {Cipher} for method chaining.
353
+ - Returns: {Cipher} for method chaining.
353
354
354
355
When using an authenticated encryption mode (only ` GCM ` is currently
355
356
supported), the ` decipher.setAAD() ` method sets the value used for the
@@ -366,7 +367,7 @@ changes:
366
367
description: This method now returns a reference to `decipher`.
367
368
-->
368
369
- ` buffer ` {Buffer | TypedArray | DataView}
369
- - Returns the {Cipher} for method chaining.
370
+ - Returns: {Cipher} for method chaining.
370
371
371
372
When using an authenticated encryption mode (only ` GCM ` is currently
372
373
supported), the ` decipher.setAuthTag() ` method is used to pass in the
@@ -390,7 +391,7 @@ The `decipher.setAuthTag()` method must be called before
390
391
added: v0.7.1
391
392
-->
392
393
- ` autoPadding ` {boolean} ** Default:** ` true `
393
- - Returns the {Cipher} for method chaining.
394
+ - Returns: {Cipher} for method chaining.
394
395
395
396
When data has been encrypted without standard block padding, calling
396
397
` decipher.setAutoPadding(false) ` will disable automatic padding to prevent
@@ -413,6 +414,7 @@ changes:
413
414
- ` data ` {string | Buffer | TypedArray | DataView}
414
415
- ` inputEncoding ` {string}
415
416
- ` outputEncoding ` {string}
417
+ - Returns: {Buffer | string}
416
418
417
419
Updates the decipher with ` data ` . If the ` inputEncoding ` argument is given,
418
420
its value must be one of ` 'latin1' ` , ` 'base64' ` , or ` 'hex' ` and the ` data `
@@ -467,6 +469,7 @@ added: v0.5.0
467
469
- ` otherPublicKey ` {string | Buffer | TypedArray | DataView}
468
470
- ` inputEncoding ` {string}
469
471
- ` outputEncoding ` {string}
472
+ - Returns: {Buffer | string}
470
473
471
474
Computes the shared secret using ` otherPublicKey ` as the other
472
475
party's public key and returns the computed shared secret. The supplied
@@ -484,6 +487,7 @@ If `outputEncoding` is given a string is returned; otherwise, a
484
487
added: v0.5.0
485
488
-->
486
489
- ` encoding ` {string}
490
+ - Returns: {Buffer | string}
487
491
488
492
Generates private and public Diffie-Hellman key values, and returns
489
493
the public key in the specified ` encoding ` . This key should be
@@ -496,6 +500,7 @@ or `'base64'`. If `encoding` is provided a string is returned; otherwise a
496
500
added: v0.5.0
497
501
-->
498
502
- ` encoding ` {string}
503
+ - Returns: {Buffer | string}
499
504
500
505
Returns the Diffie-Hellman generator in the specified ` encoding ` , which can
501
506
be ` 'latin1' ` , ` 'hex' ` , or ` 'base64' ` . If ` encoding ` is provided a string is
@@ -506,6 +511,7 @@ returned; otherwise a [`Buffer`][] is returned.
506
511
added: v0.5.0
507
512
-->
508
513
- ` encoding ` {string}
514
+ - Returns: {Buffer | string}
509
515
510
516
Returns the Diffie-Hellman prime in the specified ` encoding ` , which can
511
517
be ` 'latin1' ` , ` 'hex' ` , or ` 'base64' ` . If ` encoding ` is provided a string is
@@ -516,6 +522,7 @@ returned; otherwise a [`Buffer`][] is returned.
516
522
added: v0.5.0
517
523
-->
518
524
- ` encoding ` {string}
525
+ - Returns: {Buffer | string}
519
526
520
527
Returns the Diffie-Hellman private key in the specified ` encoding ` ,
521
528
which can be ` 'latin1' ` , ` 'hex' ` , or ` 'base64' ` . If ` encoding ` is provided a
@@ -526,6 +533,7 @@ string is returned; otherwise a [`Buffer`][] is returned.
526
533
added: v0.5.0
527
534
-->
528
535
- ` encoding ` {string}
536
+ - Returns: {Buffer | string}
529
537
530
538
Returns the Diffie-Hellman public key in the specified ` encoding ` , which
531
539
can be ` 'latin1' ` , ` 'hex' ` , or ` 'base64' ` . If ` encoding ` is provided a
@@ -613,6 +621,7 @@ changes:
613
621
- ` otherPublicKey ` {string | Buffer | TypedArray | DataView}
614
622
- ` inputEncoding ` {string}
615
623
- ` outputEncoding ` {string}
624
+ - Returns: {Buffer | string}
616
625
617
626
Computes the shared secret using ` otherPublicKey ` as the other
618
627
party's public key and returns the computed shared secret. The supplied
@@ -631,6 +640,7 @@ added: v0.11.14
631
640
-->
632
641
- ` encoding ` {string}
633
642
- ` format ` {string} ** Default:** ` uncompressed `
643
+ - Returns: {Buffer | string}
634
644
635
645
Generates private and public EC Diffie-Hellman key values, and returns
636
646
the public key in the specified ` format ` and ` encoding ` . This key should be
@@ -649,20 +659,18 @@ is returned.
649
659
added: v0.11.14
650
660
-->
651
661
- ` encoding ` {string}
652
-
653
- Returns the EC Diffie-Hellman private key in the specified ` encoding ` ,
654
- which can be ` 'latin1' ` , ` 'hex' ` , or ` 'base64' ` . If ` encoding ` is provided
655
- a string is returned; otherwise a [ ` Buffer ` ] [ ] is returned.
662
+ - Returns: {Buffer | string} The EC Diffie-Hellman private key in the specified
663
+ ` encoding ` , which can be ` 'latin1' ` , ` 'hex' ` , or ` 'base64' ` . If ` encoding `
664
+ is provided a string is returned; otherwise a [ ` Buffer ` ] [ ] is returned.
656
665
657
666
### ecdh.getPublicKey([ encoding] [ , format ] )
658
667
<!-- YAML
659
668
added: v0.11.14
660
669
-->
661
670
- ` encoding ` {string}
662
671
- ` format ` {string} ** Default:** ` uncompressed `
663
-
664
- Returns the EC Diffie-Hellman public key in the specified ` encoding ` and
665
- ` format ` .
672
+ - Returns: {Buffer | string} The EC Diffie-Hellman public key in the specified
673
+ ` encoding ` and ` format ` .
666
674
667
675
The ` format ` argument specifies point encoding and can be ` 'compressed' ` or
668
676
` 'uncompressed' ` . If ` format ` is not specified the point will be returned in
@@ -798,6 +806,7 @@ console.log(hash.digest('hex'));
798
806
added: v0.1.92
799
807
-->
800
808
- ` encoding ` {string}
809
+ - Returns: {Buffer | string}
801
810
802
811
Calculates the digest of all of the data passed to be hashed (using the
803
812
[ ` hash.update() ` ] [ ] method). The ` encoding ` can be ` 'hex' ` , ` 'latin1' ` or
@@ -889,6 +898,7 @@ console.log(hmac.digest('hex'));
889
898
added: v0.1.94
890
899
-->
891
900
- ` encoding ` {string}
901
+ - Returns: {Buffer | string}
892
902
893
903
Calculates the HMAC digest of all of the data passed using [ ` hmac.update() ` ] [ ] .
894
904
The ` encoding ` can be ` 'hex' ` , ` 'latin1' ` or ` 'base64' ` . If ` encoding ` is
@@ -992,6 +1002,7 @@ changes:
992
1002
- ` key ` {string}
993
1003
- ` passphrase ` {string}
994
1004
- ` outputFormat ` {string}
1005
+ - Returns: {Buffer | string}
995
1006
996
1007
Calculates the signature on all the data passed through using either
997
1008
[ ` sign.update() ` ] [ ] or [ ` sign.write() ` ] [ stream-writable-write ] .
@@ -1115,6 +1126,8 @@ changes:
1115
1126
- ` object ` {string | Object}
1116
1127
- ` signature ` {string | Buffer | TypedArray | DataView}
1117
1128
- ` signatureFormat ` {string}
1129
+ - Returns: {boolean} ` true ` or ` false ` depending on the validity of the
1130
+ signature for the data and public key.
1118
1131
1119
1132
Verifies the provided data using the given ` object ` and ` signature ` .
1120
1133
The ` object ` argument can be either a string containing a PEM encoded object,
@@ -1140,9 +1153,6 @@ If a `signatureFormat` is specified, the `signature` is expected to be a
1140
1153
string; otherwise ` signature ` is expected to be a [ ` Buffer ` ] [ ] ,
1141
1154
` TypedArray ` , or ` DataView ` .
1142
1155
1143
- Returns ` true ` or ` false ` depending on the validity of the signature for
1144
- the data and public key.
1145
-
1146
1156
The ` verify ` object can not be used again after ` verify.verify() ` has been
1147
1157
called. Multiple calls to ` verify.verify() ` will result in an error being
1148
1158
thrown.
@@ -1153,10 +1163,9 @@ thrown.
1153
1163
<!-- YAML
1154
1164
added: v6.3.0
1155
1165
-->
1156
-
1157
- Returns an object containing commonly used constants for crypto and security
1158
- related operations. The specific constants currently defined are described in
1159
- [ Crypto Constants] [ ] .
1166
+ - Returns: {Object} An object containing commonly used constants for crypto and
1167
+ security related operations. The specific constants currently defined are
1168
+ described in [ Crypto Constants] [ ] .
1160
1169
1161
1170
### crypto.DEFAULT_ENCODING
1162
1171
<!-- YAML
@@ -1188,6 +1197,7 @@ added: v0.1.94
1188
1197
- ` algorithm ` {string}
1189
1198
- ` password ` {string | Buffer | TypedArray | DataView}
1190
1199
- ` options ` {Object} [ ` stream.transform ` options] [ ]
1200
+ - Returns: {Cipher}
1191
1201
1192
1202
Creates and returns a ` Cipher ` object that uses the given ` algorithm ` and
1193
1203
` password ` . Optional ` options ` argument controls stream behavior.
@@ -1229,6 +1239,7 @@ changes:
1229
1239
- ` key ` {string | Buffer | TypedArray | DataView}
1230
1240
- ` iv ` {string | Buffer | TypedArray | DataView}
1231
1241
- ` options ` {Object} [ ` stream.transform ` options] [ ]
1242
+ - Returns: {Cipher}
1232
1243
1233
1244
Creates and returns a ` Cipher ` object, with the given ` algorithm ` , ` key ` and
1234
1245
initialization vector (` iv ` ). Optional ` options ` argument controls stream behavior.
@@ -1267,6 +1278,7 @@ added: v0.1.94
1267
1278
- ` algorithm ` {string}
1268
1279
- ` password ` {string | Buffer | TypedArray | DataView}
1269
1280
- ` options ` {Object} [ ` stream.transform ` options] [ ]
1281
+ - Returns: {Decipher}
1270
1282
1271
1283
Creates and returns a ` Decipher ` object that uses the given ` algorithm ` and
1272
1284
` password ` (key). Optional ` options ` argument controls stream behavior.
@@ -1296,6 +1308,7 @@ changes:
1296
1308
- ` key ` {string | Buffer | TypedArray | DataView}
1297
1309
- ` iv ` {string | Buffer | TypedArray | DataView}
1298
1310
- ` options ` {Object} [ ` stream.transform ` options] [ ]
1311
+ - Returns: {Decipher}
1299
1312
1300
1313
Creates and returns a ` Decipher ` object that uses the given ` algorithm ` , ` key `
1301
1314
and initialization vector (` iv ` ). Optional ` options ` argument controls stream
@@ -1376,6 +1389,7 @@ added: v0.1.92
1376
1389
-->
1377
1390
- ` algorithm ` {string}
1378
1391
- ` options ` {Object} [ ` stream.transform ` options] [ ]
1392
+ - Returns: {Hash}
1379
1393
1380
1394
Creates and returns a ` Hash ` object that can be used to generate hash digests
1381
1395
using the given ` algorithm ` . Optional ` options ` argument controls stream
@@ -1413,6 +1427,7 @@ added: v0.1.94
1413
1427
- ` algorithm ` {string}
1414
1428
- ` key ` {string | Buffer | TypedArray | DataView}
1415
1429
- ` options ` {Object} [ ` stream.transform ` options] [ ]
1430
+ - Returns: {Hmac}
1416
1431
1417
1432
Creates and returns an ` Hmac ` object that uses the given ` algorithm ` and ` key ` .
1418
1433
Optional ` options ` argument controls stream behavior.
@@ -1450,6 +1465,7 @@ added: v0.1.92
1450
1465
-->
1451
1466
- ` algorithm ` {string}
1452
1467
- ` options ` {Object} [ ` stream.Writable ` options] [ ]
1468
+ - Returns: {Sign}
1453
1469
1454
1470
Creates and returns a ` Sign ` object that uses the given ` algorithm ` .
1455
1471
Use [ ` crypto.getHashes() ` ] [ ] to obtain an array of names of the available
@@ -1462,6 +1478,7 @@ added: v0.1.92
1462
1478
-->
1463
1479
- ` algorithm ` {string}
1464
1480
- ` options ` {Object} [ ` stream.Writable ` options] [ ]
1481
+ - Returns: {Verify}
1465
1482
1466
1483
Creates and returns a ` Verify ` object that uses the given algorithm.
1467
1484
Use [ ` crypto.getHashes() ` ] [ ] to obtain an array of names of the available
@@ -1472,8 +1489,8 @@ signing algorithms. Optional `options` argument controls the
1472
1489
<!-- YAML
1473
1490
added: v0.9.3
1474
1491
-->
1475
-
1476
- Returns an array with the names of the supported cipher algorithms.
1492
+ - Returns: {string [ ] } An array with the names of the supported cipher
1493
+ algorithms.
1477
1494
1478
1495
Example:
1479
1496
@@ -1486,8 +1503,7 @@ console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...]
1486
1503
<!-- YAML
1487
1504
added: v2.3.0
1488
1505
-->
1489
-
1490
- Returns an array with the names of the supported elliptic curves.
1506
+ - Returns: {string[ ] } An array with the names of the supported elliptic curves.
1491
1507
1492
1508
Example:
1493
1509
@@ -1501,6 +1517,7 @@ console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
1501
1517
added: v0.7.5
1502
1518
-->
1503
1519
- ` groupName ` {string}
1520
+ - Returns: {Object}
1504
1521
1505
1522
Creates a predefined ` DiffieHellman ` key exchange object. The
1506
1523
supported groups are: ` 'modp1' ` , ` 'modp2' ` , ` 'modp5' ` (defined in
@@ -1534,9 +1551,8 @@ console.log(aliceSecret === bobSecret);
1534
1551
<!-- YAML
1535
1552
added: v0.9.3
1536
1553
-->
1537
-
1538
- Returns an array of the names of the supported hash algorithms,
1539
- such as ` RSA-SHA256 ` .
1554
+ - Returns: {string[ ] } An array of the names of the supported hash algorithms,
1555
+ such as ` 'RSA-SHA256' ` .
1540
1556
1541
1557
Example:
1542
1558
@@ -1622,6 +1638,7 @@ changes:
1622
1638
- ` iterations ` {number}
1623
1639
- ` keylen ` {number}
1624
1640
- ` digest ` {string}
1641
+ - Returns: {Buffer}
1625
1642
1626
1643
Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
1627
1644
implementation. A selected HMAC digest algorithm specified by ` digest ` is
@@ -1737,6 +1754,7 @@ added: v0.5.8
1737
1754
- ` callback ` {Function}
1738
1755
- ` err ` {Error}
1739
1756
- ` buf ` {Buffer}
1757
+ - Returns: {Buffer} if the ` callback ` function is not provided.
1740
1758
1741
1759
Generates cryptographically strong pseudo-random data. The ` size ` argument
1742
1760
is a number indicating the number of bytes to generate.
@@ -1789,11 +1807,10 @@ added: v7.10.0
1789
1807
* ` buffer ` {Buffer|Uint8Array} Must be supplied.
1790
1808
* ` offset ` {number} ** Default:** ` 0 `
1791
1809
* ` size ` {number} ** Default:** ` buffer.length - offset `
1810
+ * Returns: {Buffer}
1792
1811
1793
1812
Synchronous version of [ ` crypto.randomFill() ` ] [ ] .
1794
1813
1795
- Returns ` buffer `
1796
-
1797
1814
``` js
1798
1815
const buf = Buffer .alloc (10 );
1799
1816
console .log (crypto .randomFillSync (buf).toString (' hex' ));
@@ -1885,6 +1902,7 @@ added: v6.6.0
1885
1902
-->
1886
1903
- ` a ` {Buffer | TypedArray | DataView}
1887
1904
- ` b ` {Buffer | TypedArray | DataView}
1905
+ - Returns: {boolean}
1888
1906
1889
1907
This function is based on a constant-time algorithm.
1890
1908
Returns true if ` a ` is equal to ` b ` , without leaking timing information that
0 commit comments