Search code examples
windowsnode.jscertificatestore

Nodejs - Windows Key/Certificate store


Does anybody have any pointers as to how I could go about interacting with the Key/Certificate store using nodeJs? I specifically want to add/remove certificates and possibly keys.

Update.

So the way to go here is to use "edge". Very nice work!

https://github.com/tjanczuk/edge


Solution

  • Without knowing too much about your setup here is a stab at a 'pointer' as to how to interact.

    You could try using Nodes Child Process and then spawning out a process to the commandline and interact with the key/certificate store the way you would via command line. Microsofts certificate manager tool perhaps?

    Rough example:

    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);
      }
    });