title: Different approaches for accessing OpenSSL from Node.js
body: <p>I am looking for a way to integrate OpenSSL and Node.js for a while now.</p>
  
  <p>My goals are:</p>
  
  <ul>
  <li>I want to be platform independent, hence a solution should work on OS X, Linux and Windows.</li>
  <li>I want to avoid unnecessary disk operations. E.g., a private key might not be in a file, but in a database (may be a stupid example, but let's consider this to be a valid requirement).</li>
  <li>I want to support creating keys, csrs, signing csrs, creating ca certs, ... all the certificate stuff, from end to end.</li>
  </ul>
  
  <p>Now the options I have considered are:</p>
  
  <ul>
  <li>Use the OpenSSL library which is integrated within Node.js. Unfortunately, the crypto module does not provide the certificate things.</li>
  <li>Use the OpenSSL library using an external module. Unfortunately, I don't know how to do this, probably due to missing knowledge in C/C++.</li>
  <li>Use the OpenSSL binary as a child process. Given that OpenSSL is available, this should work on all platforms. It's not nice, but it works.</li>
  </ul>
  
  <p>Question #1: As I have written I do not have the slightest idea on how access the OpenSSL library directly that comes bundled with Node.js. How would I approach this?</p>
  
  <p>At the moment, I stick with using the binary as a child process. Unfortunately, this requires that all the things such as private keys and so on are either given as files (which I explicitly want to avoid), or that I hand over everything using /dev/stdin (which does not work on Windows).</p>
  
  <p>Question #2: How could I deal with this? Would a solution to #1 solve this issue, too?</p>