ecdh.generateKeys([encoding[, format]])
生成私有和公共 EC Diffie-Hellman 密钥值,并返回指定 format
和 encoding
中的公钥。
此密钥应转让给另一方。
format
参数指定点编码,可以是 'compressed'
或 'uncompressed'
。
如果未指定 format
,则该点将以 'uncompressed'
格式返回。
如果提供了 encoding
,则返回字符串;否则返回 Buffer
。
encoding
<string> The encoding of the return value.format
<string> Default:'uncompressed'
- Returns: <Buffer> | <string>
Generates private and public EC Diffie-Hellman key values, and returns
the public key in the specified format
and encoding
. This key should be
transferred to the other party.
The format
argument specifies point encoding and can be 'compressed'
or
'uncompressed'
. If format
is not specified, the point will be returned in
'uncompressed'
format.
If encoding
is provided a string is returned; otherwise a Buffer
is returned.