Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1519

Verify ssl certificate in nodejs

$
0
0

How can I verify SSL certificate on https of given domain by NodeJS?

I need to know if user open this like is it trusted or should add it as exception?

--

I think this code should raise error during unsigned or selfsigned certificate.

var https = require('https');var options = {  host: 'daarkoob.ir',  port: 2222,  path: '/',  method: 'GET',  rejectUnauthorized:true};var req = https.request(options, function(res) {  console.log("statusCode: ", res.statusCode);  console.log("headers: ", res.headers);});req.end();req.on('error', function(e) {  console.error(e);});

https://daarkoob.ir:2222 is self signed certificated,so above code should raise error during surfing.but nothing happened.


Viewing all articles
Browse latest Browse all 1519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>