【问题标题】:Nodejs - Windows Key/Certificate storeNodejs - Windows 密钥/证书存储
【发布时间】:2013-05-27 14:51:24
【问题描述】:

是否有人对我如何使用 nodeJs 与密钥/证书存储进行交互有任何指示?我特别想添加/删除证书和可能的密钥。

更新。

所以这里的方法是使用“边缘”。非常棒的作品!

https://github.com/tjanczuk/edge

【问题讨论】:

    标签: windows node.js certificate store


    【解决方案1】:

    在不了解您的设置的情况下,这里只是针对如何交互的“指针”。

    您可以尝试使用Nodes Child Process,然后向命令行生成一个进程,并通过命令行与密钥/证书存储进行交互。也许是微软certificate manager tool

    粗略的例子:

    var exec = require('child_process').exec,
    child;
    
    child = exec('certmgr /add /all /c myFile.ext newFile.ext', 
    
    function (error, stdout, stderr) {
      console.log('stdout: ' + stdout);
      console.log('stderr: ' + stderr);
      if (error !== null) {
        console.log('exec error: ' + error);
      }
    });
    

    【讨论】:

    • 非常好,这是一个相当安全的赌注。但是,我想知道是否有一种无需调用命令行的方法。
    • 快速搜索npmjs.org 对模块来说似乎没有希望。基本程序中没有任何东西可以做到这一点。
    • 你有没有通过the NPM registry查看任何可能有帮助的包?
    【解决方案2】:

    我刚刚发布了node-windows-root-certs,它使用 ffi 读取 windows 根证书存储,然后在 nodejs 中应用这些......可能会提供一些启发。

    使用 Windows 证书而不是内部 NodeJS 证书的示例:

    var windowsRootCerts = require('node-windows-root-certs');
    // to read the windows root certs and patch in a single command:
    windowsRootCerts.useWindowsCerts();
    

    【讨论】:

      【解决方案3】:

      有一个 npm 包“windows-certs”,它使用边缘和.csx 脚本来读取.pem 格式的证书

      这应该具有所需的功能,但被标记为已弃用。后继包表示为.win-ca。但是,这似乎缺少旧包的一些功能:

      【讨论】:

      • 现已弃用,github 注释说“使用 github.com/ukoloff/win-ca”,但它有点不同
      • 你的意思是successor而不是predecessor。但是 windows-certs 做了,而 win-ca 只做 read 并且这个 Q 要求“添加/删除”。
      • 原始答案已被编辑,显然已损坏,现在我投了反对票!我会重新扩展。
      猜你喜欢
      • 2011-11-09
      • 1970-01-01
      • 2013-03-30
      • 2013-03-18
      • 2021-03-21
      • 2013-05-30
      • 1970-01-01
      • 2010-10-24
      • 1970-01-01
      相关资源
      最近更新 更多