title: Accessing signing/encryption in a browser's Keystore using JavaScript - sample code? (WebCryptoAPI)
body: <p>I have a web server that allows access only using X509 authentication. Works like a charm. Now I want to extend the use of the X509 certificates (which are stored in the user's browser keystore) to</p>
  
  <ul>
  <li>Sign data before it is sent to the server (using JavaScript and HTTPPost)</li>
  <li>Decrypt data read from the server (where it gets encrypted using the user's public key stored there)</li>
  </ul>
  
  <p>I found this example doing <a href="http://cdn9.atwikiimg.com/kurushima/pub/jsrsa/sample-rsasign.html" rel="noreferrer">RSA Signature</a> which is pretty close.... only it does take the key from a HTML textarea. I want to read it from the key store. Now crypto is quite in flux:</p>
  
  <ul>
  <li><a href="https://developer.mozilla.org/en-US/docs/JavaScript_crypto" rel="noreferrer">Mozilla</a></li>
  <li><a href="http://www.w3.org/TR/WebCryptoAPI/" rel="noreferrer">w3C</a></li>
  <li><a href="http://msdn.microsoft.com/en-us/library/ie/dn302338.aspx" rel="noreferrer">Internet Explorer 11++</a></li>
  <li><a href="http://www.chromestatus.com/features/5030265697075200" rel="noreferrer">Chome and Chromium</a></li>
  </ul>
  
  <p>I'm looking for some working examples for signature and encryption (I have some in Java, but not browser based JavaScript).</p>
  
  <p>Help is very much appreciated</p>