1

We are trying to implement the following workflow:

  • generate private key in browser, using window.crypto
  • create a PKCS10 certificate signing request in the browser
  • send the PKCS10 to a server
  • the server signs the request and returns an x509 certificate in PEM format
  • the browser stores the certificate for itself

The same thing already works using the keygen tag in the browser and using SPKAC instead of pkcs10. Now, however the browser does not store the certificate returned, just wants to save them. When we try to import the certificate to the browser by hand, we got "the private key for the certificate is missing or invalid". We suspect that the private key generated by window.crypto.generateKey() does not get stored in the browser's keystore. How to get the private key stored in the keystore?

The implementation of the first two steps is based on http://blog.engelke.com/2014/08/23/public-key-cryptography-in-the-browser/

Update: As some browsers use the OS keystore, I am also looking into the possibility to save the key into the OS keystore through some other way. What I have figured out so far:

Java cannot be used according to this question: Tell Java to use Windows keystore

In Windows one can use ActiveX controls.

Summary: Found no standard cross-browser and cross-OS way to generate and meaningfully use X509 certificates. There are combinations (new chrome versions (dropping keygen support) on non-windows OS) where there is no way to do this.

Community
  • 1
  • 1
Árpád Magosányi
  • 1,394
  • 2
  • 19
  • 35

0 Answers0