I need to sync with my server with the client certificate abc.pfx
which is generated by the server using Ajax. How do I send my certificate with Ajax object. Can I do this certificate authentication with JavaScript?
-
1Some clarification here would be helpful. Syncing vs. authentication - why is the cert needed, what are you trying to accomplish? Generally, when authentication is the goal, you also need a proof of private key, so just checking that the certificate is valid won't be sufficient.– bethlakshmiMay 15, 2013 at 14:37
1 Answer
There is no interface to SSL authentication (either server-client or client-server) from JavaScript. It is all dealt with by the browser UI.
On IE, you may be able to use the CertEnroll (previously XEnroll) ActiveX control as a way to get a newly-generated key into the user's keystore; otherwise you would just have to require them to install the certificate themselves.
Either way, when a request is made that requires the client cert - be it AJAX or normal web page access - the browser is repsonsible for using the cert (which may involve popping up a dialogue for the user to pick which cert they want).