@@ -1951,27 +1951,22 @@ changes: |
1951 | 1951 | - `publicExponent`: {number} Public exponent (RSA). **Default:** `0x10001`. |
1952 | 1952 | - `divisorLength`: {number} Size of `q` in bits (DSA). |
1953 | 1953 | - `namedCurve`: {string} Name of the curve to use (EC). |
1954 | | - - `publicKeyEncoding`: {Object} |
1955 | | - - `type`: {string} Must be one of `'pkcs1'` (RSA only) or `'spki'`. |
1956 | | - - `format`: {string} Must be `'pem'` or `'der'`. |
1957 | | - - `privateKeyEncoding`: {Object} |
1958 | | - - `type`: {string} Must be one of `'pkcs1'` (RSA only), `'pkcs8'` or |
1959 | | - `'sec1'` (EC only). |
1960 | | - - `format`: {string} Must be `'pem'` or `'der'`. |
1961 | | - - `cipher`: {string} If specified, the private key will be encrypted with |
1962 | | - the given `cipher` and `passphrase` using PKCS#5 v2.0 password based |
1963 | | - encryption. |
1964 | | - - `passphrase`: {string | Buffer} The passphrase to use for encryption, see |
1965 | | - `cipher`. |
| 1954 | + - `publicKeyEncoding`: {Object} See [`keyObject.export()`][]. |
| 1955 | + - `privateKeyEncoding`: {Object} See [`keyObject.export()`][]. |
1966 | 1956 | * Returns: {Object} |
1967 | 1957 | - `publicKey`: {string | Buffer | KeyObject} |
1968 | 1958 | - `privateKey`: {string | Buffer | KeyObject} |
1969 | 1959 |
|
1970 | 1960 | Generates a new asymmetric key pair of the given `type`. Only RSA, DSA and EC |
1971 | 1961 | are currently supported. |
1972 | 1962 |
|
1973 | | -It is recommended to encode public keys as `'spki'` and private keys as |
1974 | | -`'pkcs8'` with encryption: |
| 1963 | +If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function |
| 1964 | +behaves as if [`keyObject.export()`][] had been called on its result. Otherwise, |
| 1965 | +the respective part of the key is returned as a [`KeyObject`]. |
| 1966 | + |
| 1967 | +When encoding public keys, it is recommended to use `'spki'`. When encoding |
| 1968 | +private keys, it is recommended to use `'pks8'` with a strong passphrase, and to |
| 1969 | +keep the passphrase confidential. |
1975 | 1970 |
|
1976 | 1971 | ```js |
1977 | 1972 | const { generateKeyPairSync } = require('crypto'); |
|