SSL pfx 文件的 Node JS 问题

问题描述 投票:0回答:2

当我运行 server.js 时,我遇到了这个问题:

node:internal/tls/secure-context:277
      context.loadPKCS12(toBuf(pfx), toBuf(passphrase));
              ^

Error: unsupported
    at configSecureContext (node:internal/tls/secure-context:277:15)
    at Object.createSecureContext (node:_tls_common:117:3)
    at Server.setSecureContext (node:_tls_wrap:1354:27)
    at Server (node:_tls_wrap:1218:8)
    at new Server (node:https:74:3)
    at Object.createServer (node:https:112:10)
    at Object.<anonymous> (/home/user/nodeserver/server.js:21:27)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)

Node.js v18.14.2

我运行这个命令是为了看看出了什么问题,但我不知道:

openssl pkcs12 -info -in ssl/pfxFile.pfx -noout

这是命令的输出:

MAC: sha1, Iteration 1024
MAC length: 20, salt length: 20
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 1024
Certificate bag
Certificate bag
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 1024

我尝试执行 pfx 文件两次,但每次都出现同样的问题,我在没有密码的情况下尝试,我不知道什么可以阻止此操作,我更新了 Node,现在我无法启动我的服务器。

节点的更改是否会改变证书的某些内容?

感谢您的回答。

node.js express ssl certificate pfx
2个回答
2
投票

尝试切换到较低的 LTS 节点版本。我今天遇到了同样的问题,从 18.14 LTS 升级到 16.19 LTS 解决了它。截至今天,人们仍然遇到同样的问题


0
投票

在 Node.js v18.14.2 上遇到 PFX 证书“不受支持”的错误?这是一个简单的解决方案:

  1. 使用
    NODE_OPTIONS=--openssl-legacy-provider
    运行服务器,如下所示:
    NODE_OPTIONS=--openssl-legacy-provider node server.js
    
  2. 有关详细演练,请查看我的文章:在此处阅读全文

希望这有帮助!如果您有疑问,请告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.