Send SSL Certificate using Javascript

Viewed 199

I need to load my SSL Certificate through client Java script, i am using third-party API which is hosted on Cloud. The connection type is 2-way SSL also called MASSL. I need to pass my certificate from Client Java Script through my browser,

So kindly let me know if any other approaches like node modules, javascript or JQuery Plugins or some other approach please let me know.

Example:

// 1. Create a new XMLHttpRequest object
let xhr = new XMLHttpRequest();

// 2. Configure it: GET-request for the URL /article/.../load
xhr.open('GET', 'https://sample.com');

// 3. Send the request over the network
xhr.send('D:/Certificates/Sample.crt');

// 4. This will be called after the response is received
  xhr.onload = function() {
    if (xhr.status != 200) { // analyze HTTP status of the response
      alert(`Error ${xhr.status}: ${xhr.statusText}`); // e.g. 404: Not    Found
    } else { // show the result
       alert(`Done, got ${xhr.response.length} bytes`); // response is the   server response
    }
 };

 xhr.onprogress = function(event) {
    if (event.lengthComputable) {
      alert(`Received ${event.loaded} of ${event.total} bytes`);
    } else {
      alert(`Received ${event.loaded} bytes`); // no Content-Length
    }

 };

Thanks,

0 Answers
Related