Skip to content

Commit 29dbf82

Browse files
committed
doc: clarify documentation in crypto
Clarify on the return values for crypto.publicEncrypt and similar functions Fixes: nodejs#12946
1 parent c81fd7c commit 29dbf82

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/api/crypto.md

+12
Original file line numberDiff line numberDiff line change
@@ -1687,12 +1687,15 @@ added: v0.11.14
16871687
`crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`,
16881688
`RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`.
16891689
- `buffer` {Buffer | TypedArray | DataView}
1690+
- Returns: {Buffer}
16901691

16911692
Decrypts `buffer` with `privateKey`.
16921693

16931694
`privateKey` can be an object or a string. If `privateKey` is a string, it is
16941695
treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
16951696

1697+
Returns a new `Buffer` with the decrypted content.
1698+
16961699
### crypto.privateEncrypt(privateKey, buffer)
16971700
<!-- YAML
16981701
added: v1.1.0
@@ -1704,12 +1707,15 @@ added: v1.1.0
17041707
`crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or
17051708
`RSA_PKCS1_PADDING`.
17061709
- `buffer` {Buffer | TypedArray | DataView}
1710+
- Returns: {Buffer}
17071711

17081712
Encrypts `buffer` with `privateKey`.
17091713

17101714
`privateKey` can be an object or a string. If `privateKey` is a string, it is
17111715
treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
17121716

1717+
Returns a new `Buffer` with the encrypted content.
1718+
17131719
### crypto.publicDecrypt(publicKey, buffer)
17141720
<!-- YAML
17151721
added: v1.1.0
@@ -1721,6 +1727,7 @@ added: v1.1.0
17211727
`crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or
17221728
`RSA_PKCS1_PADDING`.
17231729
- `buffer` {Buffer | TypedArray | DataView}
1730+
- Returns: {Buffer}
17241731

17251732
Decrypts `buffer` with `publicKey`.
17261733

@@ -1730,6 +1737,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
17301737
Because RSA public keys can be derived from private keys, a private key may
17311738
be passed instead of a public key.
17321739

1740+
Returns a new `Buffer` with the decrypted content.
1741+
17331742
### crypto.publicEncrypt(publicKey, buffer)
17341743
<!-- YAML
17351744
added: v0.11.14
@@ -1741,6 +1750,7 @@ added: v0.11.14
17411750
`crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`,
17421751
`RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`.
17431752
- `buffer` {Buffer | TypedArray | DataView}
1753+
- Returns: {Buffer}
17441754

17451755
Encrypts the content of `buffer` with `publicKey` and returns a new
17461756
[`Buffer`][] with encrypted content.
@@ -1751,6 +1761,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
17511761
Because RSA public keys can be derived from private keys, a private key may
17521762
be passed instead of a public key.
17531763

1764+
Returns a new `Buffer` with the encrypted content.
1765+
17541766
### crypto.randomBytes(size[, callback])
17551767
<!-- YAML
17561768
added: v0.5.8

0 commit comments

Comments
 (0)