如何解决eciesjs 解密时出现错误`错误:预期私钥为长度为 32 的 Uint8Array`
我正在使用 eciesjs npm 包进行加密和解密,此加密已成功完成,但在解密时出现错误:错误:预期私钥为长度为 32 的 Uint8Array。>
这是我的代码如下:
import eciesjs from 'eciesjs'
const key=`0x12bcb941510e4a02037e03904554064a6bce209155572d69fd22c46cc4e68c3dae9175c4177d844f9a0114b85a1e0129a14ec33c3ebd64e144faa6c069581472`
const data= 'My text abc'
const cipher = eciesjs.encrypt(key,Buffer.from(data))
const encryptedData = cipher.toString('hex')
console.log('encryptedData ',encryptedData)
const decryptData = eciesjs.decrypt(key,encryptedData).toString()
console.log('decryptData = ',decryptData)
在解密时我收到如下错误:
error: Error: Expected private key to be an Uint8Array with length 32
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。