summaryrefslogtreecommitdiff
path: root/doc/api/crypto.md
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-09-12 15:25:43 +0200
committerAnna Henningsen <anna@addaleax.net>2018-09-17 17:15:14 +0200
commitc33e27dc3caf5a5b7954706fe6ecde1e4f82534d (patch)
tree9c1c6981211f222404759840a13f0b66729b66f1 /doc/api/crypto.md
parent932be0164fb3ed869ae3ddfff391721d2fd8e1af (diff)
downloadandroid-node-v8-c33e27dc3caf5a5b7954706fe6ecde1e4f82534d.tar.gz
android-node-v8-c33e27dc3caf5a5b7954706fe6ecde1e4f82534d.tar.bz2
android-node-v8-c33e27dc3caf5a5b7954706fe6ecde1e4f82534d.zip
doc: improve asymmetric crypto docs
Refs: https://github.com/nodejs/node/issues/22792 PR-URL: https://github.com/nodejs/node/pull/22820 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc/api/crypto.md')
-rw-r--r--doc/api/crypto.md16
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/api/crypto.md b/doc/api/crypto.md
index c71c292bdd..e9e2d203d4 100644
--- a/doc/api/crypto.md
+++ b/doc/api/crypto.md
@@ -1890,7 +1890,8 @@ added: v0.11.14
* `buffer` {Buffer | TypedArray | DataView}
* Returns: {Buffer} A new `Buffer` with the decrypted content.
-Decrypts `buffer` with `privateKey`.
+Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using
+the corresponding public key, for example using [`crypto.publicEncrypt()`][].
`privateKey` can be an object or a string. If `privateKey` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
@@ -1908,7 +1909,8 @@ added: v1.1.0
* `buffer` {Buffer | TypedArray | DataView}
* Returns: {Buffer} A new `Buffer` with the encrypted content.
-Encrypts `buffer` with `privateKey`.
+Encrypts `buffer` with `privateKey`. The returned data can be decrypted using
+the corresponding public key, for example using [`crypto.publicDecrypt()`][].
`privateKey` can be an object or a string. If `privateKey` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
@@ -1926,7 +1928,8 @@ added: v1.1.0
* `buffer` {Buffer | TypedArray | DataView}
* Returns: {Buffer} A new `Buffer` with the decrypted content.
-Decrypts `buffer` with `key`.
+Decrypts `buffer` with `key`.`buffer` was previously encrypted using
+the corresponding private key, for example using [`crypto.privateEncrypt()`][].
`key` can be an object or a string. If `key` is a string, it is treated as
the key with no passphrase and will use `RSA_PKCS1_PADDING`.
@@ -1949,7 +1952,8 @@ added: v0.11.14
* Returns: {Buffer} A new `Buffer` with the encrypted content.
Encrypts the content of `buffer` with `key` and returns a new
-[`Buffer`][] with encrypted content.
+[`Buffer`][] with encrypted content. The returned data can be decrypted using
+the corresponding private key, for example using [`crypto.privateDecrypt()`][].
`key` can be an object or a string. If `key` is a string, it is treated as
the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
@@ -2741,6 +2745,10 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
[`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm_options
[`crypto.getCurves()`]: #crypto_crypto_getcurves
[`crypto.getHashes()`]: #crypto_crypto_gethashes
+[`crypto.privateDecrypt()`]: #crypto_crypto_privatedecrypt_privatekey_buffer
+[`crypto.privateEncrypt()`]: #crypto_crypto_privateencrypt_privatekey_buffer
+[`crypto.publicDecrypt()`]: #crypto_crypto_publicdecrypt_key_buffer
+[`crypto.publicEncrypt()`]: #crypto_crypto_publicencrypt_key_buffer
[`crypto.randomBytes()`]: #crypto_crypto_randombytes_size_callback
[`crypto.randomFill()`]: #crypto_crypto_randomfill_buffer_offset_size_callback
[`crypto.scrypt()`]: #crypto_crypto_scrypt_password_salt_keylen_options_callback