Locating SSL certificate, key and CA on server

Posted by jovan on Stack Overflow See other posts from Stack Overflow or by jovan
Published on 2014-06-04T10:26:23Z Indexed on 2014/06/11 21:25 UTC
Read the original article Hit count: 218

Filed under:
|

Disclaimer: you don't need to know Node to answer this question but it would help.

I have a Node server and I need to make it work with HTTPS. As I researched around the internet, I found that I have to do something like this:

var fs = require('fs');
var credentials = {
    key: fs.readFileSync('path/to/ssl/private-key'),
    cert: fs.readFileSync('path/to/ssl/cert'),
    ca: fs.readFileSync('path/to/something/called/CA')
};
var app = require('https').createServer(credentials, handler);

I have several problems with this. First off, all the examples I found use completely different approaches.

Some link to .pem files for both the certificate and key. I don't know what pem files are but I know my certificate is .crt and my key is .key. Some start off at the root folder and some seem to just have these .pem files in the application directory. I don't.

Some use the ca thing too and some don't. This CA is supposed to be my domain's CA bundle according to some articles - but none explain where to find this file. In the ssl directory on my server I have one .crt file in the certs directory and one .key file in the keys directory, in addition to an empty csrs directory and an ssl.db file.

So, where do I find these 3 files (key, cert, ca) and how do I link to them correctly?

© Stack Overflow or respective owner

Related posts about node.js

Related posts about ssl