1

我有一个端到端可验证在线投票系统的项目。我使用在线提供的 node-seal 库生成了用于加密的私钥。我试图使用Shamir 的阈值秘密共享方案将私钥分成多个共享。我生成的密钥是 base64string 格式。尝试拆分密钥时,我必须先将其转换为十六进制,这很好,但是当我尝试拆分密钥时,出现以下错误:

错误:无效的十六进制字符。
在 hex2bin (/home/shabeeh/node_modules/secrets.js/secrets.js:458:10)
在 Object.exports.share (/home/shabeeh/node_modules/secrets.js/secrets.js:229:17)
在 / home/shabeeh/iMatter/iMatter-Web/server/SplitKey.js:75:30 错误:十六进制字符无效。
在 hex2bin (/home/shabeeh/node_modules/secrets.js/secrets.js:458:10)
在 Object.exports.share (/home/shabeeh/node_modules/secrets.js/secrets.js:229:17)
在 /主页/shabeeh/iMatter/iMatter-Web/server/SplitKey.js:75:30
/home/shabeeh/iMatter/iMatter-Web/node_modules/node-seal/dist/seal.node.js:1

!function(A,I){if("object"==typeof exports&&"object"==typeof module)module.exports=I();else if("function"==typeof define&&define.amd)define([] ,I);else{var g=I();for(var C in g)("object"==typeof exports?exports:A)[C]=g[C]}}("undefined"!=typeof self?self:this,(function(){return function(A){var I={};function g(C){if(I[C])return I[C].exports;var B=I[C ]={i:C,l:!1,exports:{}};return A[C].call(B.exports,B,B.exports,g),Bl=!0,B.exports}return gm =A,gc=I,gd=function(A,I,C){go(A,I)||Object.defineProperty(A,I,{enumerable:!0,get:C})},gr=function (A){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})}, gt=函数(一个,I){if(1&I&&(A=g(A)),8&I)return A;if(4&I&&"object"==typeof A&&A&&A.__esModule)return A;var C=Object.create(null);if(gr( C),Object.defineProperty(C,"default",{enumerable:!0,value:A}),2&I&&"string"!=typeof A)for(var B in A)gd(

RuntimeError:中止(错误:无效的十六进制字符。)。使用 -s ASSERTIONS=1 构建以获取更多信息。
在 process.IA (/home/shabeeh/iMatter/iMatter-Web/node_modules/node-seal/dist/seal.node.js:1:5494)
在 process.emit (events.js:198:13)
在 emitPromiseRejectionWarnings ( internal/process/promises.js:140:18)
在 process._tickCallback (internal/process/next_tick.js:69:34)

我无法理解问题出在哪里,因为字符串已转换为十六进制形式,我使用console.log().

我是新手,nodejs如果问题很愚蠢,我感到非常抱歉,但我坚持不懈,希望能提供任何帮助

4

0 回答 0