diffieHellman.generateKeys([encoding])
生成私有和公有的 Diffie-Hellman 密钥值,除非这些密钥值已经生成或计算过,并返回指定 encoding 的公钥。此密钥应传输给另一方。如果提供了 encoding,则返回一个字符串;否则返回一个 Buffer。
【Generates private and public Diffie-Hellman key values unless they have been
generated or computed already, and returns
the public key in the specified encoding. This key should be
transferred to the other party.
If encoding is provided a string is returned; otherwise a
Buffer is returned.】
此函数是 DH_generate_key() 的一个轻量封装。特别是,一旦生成或设置了私钥,调用此函数只会更新公钥,而不会生成新的私钥。
【This function is a thin wrapper around DH_generate_key(). In particular,
once a private key has been generated or set, calling this function only updates
the public key but does not generate a new private key.】