Node.js crypto ecdh.computeSecret

🌙
手机阅读
本文目录结构

Node.js crypto ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])版本历史

版本 变更
v10.0.0 Changed error format to better support invalid public key error
v6.0.0 The default inputEncoding changed from binary to utf8
v0.11.14 新增于: v0.11.14
  • otherPublicKey < string> | < Buffer> | < TypedArray> | < DataView>
  • inputEncoding < string> The encoding of the otherPublicKey string.
  • outputEncoding < string> The encoding of the return value.
  • Returns: < Buffer> | < string>

Computes the shared secret using otherPublicKey as the other party’s public key and returns the computed shared secret. The supplied key is interpreted using specified inputEncoding, and the returned secret is encoded using the specified outputEncoding. If the inputEncoding is not provided, otherPublicKey is expected to be a Buffer, TypedArray, or DataView.

If outputEncoding is given a string will be returned; otherwise a Buffer is returned.

ecdh.computeSecret will throw an ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY error when otherPublicKey lies outside of the elliptic curve. Since otherPublicKey is usually supplied from a remote user over an insecure network, its recommended for developers to handle this exception accordingly.


更多内容请参考:Node.js crypto 加密,或者通过 点击对应菜单 进行查看;



AXIHE / 精选资源

浏览全部教程

面试题

学习网站

前端培训
自己甄别

前端书籍

关于朱安邦

我叫 朱安邦,阿西河的站长,在杭州。

以前是一名平面设计师,后来开始接接触前端开发,主要研究前端技术中的JS方向。

业余时间我喜欢分享和交流自己的技术,欢迎大家关注我的 Bilibili

关注我: Github / 知乎

目前重心已经放在研究区块链上面了

我叫朱安邦,阿西河的站长

目前在杭州从事区块链周边的开发工作,机械专业,以前从事平面设计工作。

2014年底脱产在老家自学6个月的前端技术,自学期间几乎从未出过家门,最终找到了满意的前端工作。更多>