Hi there,

I have various test suites that use self-signed certs to test HTTPS/TLS
stuff. I'm trying to use the 'ca' option of the tls and https clients to
make them trust my certs, rather than forgoing validation at all, since I
would rather give my projects APIs for adding CAs than for disabling
validation.

However when I pass my server certificate in the 'ca' option of an HTTPS
request I get this error:

"Error: Hostname/IP doesn't match certificate's altnames"

I followed these steps to generate the certificate:
http://www.akadia.com/services/ssh_test_certificate.html

What does this error mean and how do I fix it?

Here are some example scripts that demo the problem:


// server.js

var https = require('https'),
    fs    = require('fs');

var server = https.createServer({
  cert: fs.readFileSync('./server.crt'),
  key:  fs.readFileSync('./server.key')
});

server.on('request', function(request, response) {
  response.writeHead(200, {'Content-Type': 'text/plain'});
  response.end('Hello\n');
});

server.listen(8000);


// client.js

var https = require('https'),
    fs    = require('fs');

var request = https.request({
  method: 'GET',
  host:   'localhost',
  port:   8000,
  path:   '/',
  ca:     [fs.readFileSync('./server.crt')]
});

request.on('error', function(error) {
  console.log('ERROR', error);
});

request.on('response', function(response) {
  console.log(response.statusCode);
});


-- 
James Coglan
http://jcoglan.com
+44 (0) 7771512510

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to