3

how can i install a server generated browser certificate in Mozilla and Chrome using java script. ia have this method

( 
var certData = document.getElementById("certdata").value;
 window.crypto.importUserCertificates(null, certData, false);
 )

but it is outdated and it doesn't works.

Tariq Abbas
  • 121
  • 1
  • 13
  • What do you mean by "install"? Unless this is an addon it should never have that permission. – NoBugs Jan 17 '15 at 22:44
  • by install i mean to install the certificate received from CA as a result of certificate request made by client browser.the above mentioned method was valid for old browsers but this support has been disabled for latest browsers.i am looking for a method that could take the certificate response from server and installs it on my browser(mozilla and chrome) – Tariq Abbas Jan 18 '15 at 10:20
  • i found the solution for this problem .u need to do is to out put http content-type as "application/x-x509-user-cert" the browser (Mozilla and chrome will get certificate automatically if they are with the corresponding private key) :) – Tariq Abbas Jan 19 '15 at 10:34
  • Tariq, can I have an api which returns the certificate received from CA as string but setting its content-type as "application/x-x509-user-cert" ? – Navin Leon May 21 '16 at 00:28
  • u can set its contect type mentioned but the type of data could be base64(string format). – Tariq Abbas Feb 28 '18 at 10:28

2 Answers2

2

The solution mentioned in comments - using content type "application/x-x509-user-cert" - has stopped working in Chrome since 2016 (Chrome 49). This feature has been deprecated. The long-term alternative is to use the WebCrypto API, or a higher-level API based on it, like PKI.js.

cdan
  • 3,470
  • 13
  • 27
0

You can not.

Take a look at fortofyapp.com for some middleware that enables this use case.

rmhrisk
  • 1,814
  • 10
  • 16