ecdh.generateKeys([encoding[, format]])


生成私有和公有的 EC Diffie-Hellman 密钥值,并以指定的 formatencoding 返回公钥。该密钥应传输给另一方。

【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.】

format 参数指定点的编码方式,可以是 'compressed''uncompressed'。如果未指定 format,点将以 'uncompressed' 格式返回。

【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.】

如果提供了 encoding,则返回一个字符串;否则返回一个 Buffer

【If encoding is provided a string is returned; otherwise a Buffer is returned.】