FYYPL 2021-10-21 10:39 采纳率: 66.7%
浏览 216
已结题

node运行crypto.sign函数报错

用crypto生成公钥私钥,下面的代码不会报错,但是每次运行都会重新生成密钥

const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', {
    modulusLength:1024
  });
const consumer = new OAuth("https://henryfy.atlassian.net/plugins/servlet/oauth/request-token",
  "https://henryfy.atlassian.net/plugins/servlet/oauth/access-token",
  "myKey",
  privateKey,
  "1.0",
  "http://localhost:8084/sessions/callback",
  "RSA-SHA1");

想用读取文件的形式来做,把privateKey固定,但是报错

privateKey = fs.readFileSync('jira_privatekey.pem',"utf-8")

internal/crypto/sig.js:105
  const ret = this[kHandle].sign(data, format, type, passphrase, rsaPadding,
                            ^

Error: error:25078067:DSO support routines:win32_load:could not load the shared library
    at Sign.sign (internal/crypto/sig.js:105:29)
    at exports.OAuth._createSignature (d:\OauthTest\node_modules\oauth\lib\oauth.js:211:64)
    at exports.OAuth._getSignature (d:\OauthTest\node_modules\oauth\lib\oauth.js:90:15)
    at exports.OAuth._prepareParameters (d:\OauthTest\node_modules\oauth\lib\oauth.js:300:16)
    at exports.OAuth._performSecureRequest (d:\OauthTest\node_modules\oauth\lib\oauth.js:309:31)
    at exports.OAuth.getOAuthRequestToken (d:\OauthTest\node_modules\oauth\lib\oauth.js:542:8)
    at Object.<anonymous> (d:\OauthTest\six.js:17:10)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32) {
  opensslErrorStack: [
    'error:0E076071:configuration file routines:module_run:unknown module name',
    'error:0E07506E:configuration file routines:module_load_dso:error loading dso',
    'error:25070067:DSO support routines:DSO_load:could not load the shared library'
  ],
  library: 'DSO support routines',
  function: 'win32_load',
  reason: 'could not load the shared library',
  code: 'ERR_OSSL_DSO_COULD_NOT_LOAD_THE_SHARED_LIBRARY'
}
  • 写回答

1条回答 默认 最新

  • 有问必答小助手 2021-10-25 10:20
    关注

    你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


    本次提问扣除的有问必答次数,已经为您补发到账户,我们后续会持续优化,扩大我们的服务范围,为您带来更好地服务。

    评论

报告相同问题?

问题事件

  • 系统已结题 10月29日
  • 创建了问题 10月21日

悬赏问题

  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常