crypto.diffieHellman(options)
options
: <Object>privateKey
: <KeyObject>publicKey
: <KeyObject>
- 返回: <Buffer>
基于 privateKey
和 publicKey
计算 Diffie-Hellman 秘密。
两个密钥必须具有相同的 asymmetricKeyType
,它必须是 'dh'
(对于 Diffie-Hellman)、'ec'
(对于 ECDH)、'x448'
或 'x25519'
(对于 ECDH-ES)之一。
options
: <Object>privateKey
: <KeyObject>publicKey
: <KeyObject>
- Returns: <Buffer>
Computes the Diffie-Hellman secret based on a privateKey
and a publicKey
.
Both keys must have the same asymmetricKeyType
, which must be one of 'dh'
(for Diffie-Hellman), 'ec'
(for ECDH), 'x448'
, or 'x25519'
(for ECDH-ES).